diff --git a/apps/OpenSpace/ext/launcher/include/filesystemaccess.h b/apps/OpenSpace/ext/launcher/include/filesystemaccess.h index 6acdbb1c87..945fcb113d 100644 --- a/apps/OpenSpace/ext/launcher/include/filesystemaccess.h +++ b/apps/OpenSpace/ext/launcher/include/filesystemaccess.h @@ -34,10 +34,6 @@ public: * * \param fileExtension string that defines the filter used to find files. Only * files with this extension will be recognized (e.g. '.xml') - * \param approvedPaths vector or strings containing directory names to be included - * in the search. These are directories at the base level of - * the starting point of the search. Any sub-directories within - * these directories will be included. * \param hideFileExtensions if true then file extensions will be removed from the * listed files in the output * \param useCheckboxes if true then the text output format will contain a '0' as @@ -45,8 +41,7 @@ public: * used to represent checked ('1'), uncheck ('0') or doesn't * exist in filesystem ('x') states. */ - FileSystemAccess(std::string fileExtension, - std::vector approvedPaths, bool hideFileExtensions, + FileSystemAccess(std::string fileExtension, bool hideFileExtensions, bool useCheckboxes); /** @@ -54,7 +49,8 @@ public: * * \param dir The directory from which to start the search from */ - std::string useQtFileSystemModelToTraverseDir(std::string dir, bool usersAssets = false); + std::string useQtFileSystemModelToTraverseDir(std::string dir, + bool usersAssets = false); private: void parseChildDirElements(QFileInfo item, std::string space, int level, @@ -62,7 +58,6 @@ private: bool userAssets); void parseChildFile(std::string res, bool& hasDirHeaderBeenAdded, std::vector& dirNames, std::vector& output); - bool isApprovedPath(std::string path); QFileSystemModel _filesystemModel; QDir::Filters _fileFilterOptions = QDir::Files | QDir::Dirs | QDir::NoDotAndDotDot; diff --git a/apps/OpenSpace/ext/launcher/src/filesystemaccess.cpp b/apps/OpenSpace/ext/launcher/src/filesystemaccess.cpp index 9912c3bead..f58665913d 100644 --- a/apps/OpenSpace/ext/launcher/src/filesystemaccess.cpp +++ b/apps/OpenSpace/ext/launcher/src/filesystemaccess.cpp @@ -25,15 +25,14 @@ #include "filesystemaccess.h" FileSystemAccess::FileSystemAccess(std::string fileExtension, - std::vector approvedPaths, bool hideFileExtensions, bool useCheckboxes) : _fileExtension(std::move(fileExtension)) - , _approvedPaths(std::move(approvedPaths)) , _hideFileExtensions(hideFileExtensions) , _useCheckboxes(useCheckboxes) {} -std::string FileSystemAccess::useQtFileSystemModelToTraverseDir(std::string dir, bool userAssets) { +std::string FileSystemAccess::useQtFileSystemModelToTraverseDir(std::string dir, + bool userAssets) { _filesystemModel.setRootPath(QString::fromStdString(dir)); QModelIndex index = _filesystemModel.index(_filesystemModel.rootPath()); QFileInfo fileInfo = _filesystemModel.fileInfo(index); @@ -48,8 +47,10 @@ std::string FileSystemAccess::useQtFileSystemModelToTraverseDir(std::string dir, } void FileSystemAccess::parseChildDirElements(QFileInfo fileInfo, std::string space, - int level, std::vector& dirNames, - std::vector& output, bool userAssets) + int level, + std::vector& dirNames, + std::vector& output, + bool userAssets) { QDir dir(fileInfo.filePath()); bool hasDirHeaderBeenAdded = false; @@ -62,10 +63,8 @@ void FileSystemAccess::parseChildDirElements(QFileInfo fileInfo, std::string spa res = "${USER_ASSETS}/" + res; } if (fi.isDir()) { - if (level != 0 || (level == 0 && (isApprovedPath(res) || userAssets))) { - dirNames.push_back(res); - parseChildDirElements(fi, (space + " "), level + 1, dirNames, output, userAssets); - } + dirNames.push_back(res); + parseChildDirElements(fi, (space + " "), level + 1, dirNames, output, userAssets); } else { parseChildFile(res, hasDirHeaderBeenAdded, dirNames, output); @@ -77,19 +76,6 @@ void FileSystemAccess::parseChildDirElements(QFileInfo fileInfo, std::string spa } } -bool FileSystemAccess::isApprovedPath(std::string path) { - bool approvedMatch = false; - path.erase(0, path.find_first_not_of(" ")); - - for (const std::string& p : _approvedPaths) { - if (path.substr(0, p.length()).compare(p) == 0) { - approvedMatch = true; - break; - } - } - return approvedMatch; -} - void FileSystemAccess::parseChildFile(std::string filename, bool& hasDirHeaderBeenAdded, std::vector& dirNames, std::vector& output) diff --git a/apps/OpenSpace/ext/launcher/src/profile/assettreemodel.cpp b/apps/OpenSpace/ext/launcher/src/profile/assettreemodel.cpp index 53521995f6..e588b103bd 100644 --- a/apps/OpenSpace/ext/launcher/src/profile/assettreemodel.cpp +++ b/apps/OpenSpace/ext/launcher/src/profile/assettreemodel.cpp @@ -149,9 +149,6 @@ void AssetTreeModel::importModelData(const std::string& assetBasePath, const std::string& userAssetBasePath) { FileSystemAccess assets( ".asset", - // @TODO (abock, 2021-03-24) We need some better solution for this; what is the - // problem of just including all subfolders instead? - { "scene", "global", "customization", "dashboard", "examples", "util" }, true, true );