Skip to content

Commit

Permalink
[sandbox] Allow to addWorldFiles() recursively
Browse files Browse the repository at this point in the history
  • Loading branch information
martyone committed May 24, 2013
1 parent f2aed51 commit cf5fdde
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
8 changes: 7 additions & 1 deletion libssu/sandbox.cpp
Expand Up @@ -130,7 +130,7 @@ QString Sandbox::map(const QString &fileName)
* @c QDir::NoDotAndDotDot is always added into @a filters.
*/
bool Sandbox::addWorldFiles(const QString &directory, QDir::Filters filters,
const QStringList &filterNames){
const QStringList &filterNames, bool recurse){
Q_ASSERT(!isActive());
Q_ASSERT(!directory.isEmpty());

Expand Down Expand Up @@ -186,6 +186,12 @@ bool Sandbox::addWorldFiles(const QString &directory, QDir::Filters filters,
qPrintable(sandboxEntryInfo.filePath()));
return false;
}

if (recurse){
if (!addWorldFiles(worldEntryInfo.absoluteFilePath(), filters, filterNames, true)){
return false;
}
}
} else{
if (!sandboxEntryInfo.exists()){
if (!QFile(worldEntryInfo.filePath()).copy(sandboxEntryInfo.filePath())){
Expand Down
2 changes: 1 addition & 1 deletion libssu/sandbox_p.h
Expand Up @@ -38,7 +38,7 @@ class Sandbox {
static QString map(const QString &fileName);

bool addWorldFiles(const QString &directory, QDir::Filters filters = QDir::NoFilter,
const QStringList &filterNames = QStringList());
const QStringList &filterNames = QStringList(), bool recurse = true);
bool addWorldFile(const QString &file);

private:
Expand Down

0 comments on commit cf5fdde

Please sign in to comment.