diff --git a/src/tools/balooctl/configcommand.cpp b/src/tools/balooctl/configcommand.cpp --- a/src/tools/balooctl/configcommand.cpp +++ b/src/tools/balooctl/configcommand.cpp @@ -21,6 +21,7 @@ #include "configcommand.h" #include "indexerconfig.h" +#include #include #include @@ -162,25 +163,14 @@ return 1; } - auto fileInfo = QFileInfo(args.takeFirst()); - if (!fileInfo.exists()) { - out << i18n("Path does not exist") << endl; - return 1; - } - - if (!fileInfo.isDir()) { - out << i18n("Path is not a directory") << endl; - return 1; - } - - auto path = fileInfo.absoluteFilePath(); + QString pathToRemove = args.takeFirst().replace('$HOME', QDir::homePath()); QStringList folders = config.includeFolders(); - if (!folders.contains(path)) { - out << i18n("%1 is not in the list of include folders", path) << endl; + if (!folders.contains(pathToRemove)) { + out << i18n("%1 is not in the list of include folders", pathToRemove) << endl; return 1; } - folders.removeAll(path); + folders.removeAll(pathToRemove); config.setIncludeFolders(folders); return 0; @@ -192,25 +182,14 @@ return 1; } - auto fileInfo = QFileInfo(args.takeFirst()); - if (!fileInfo.exists()) { - out << i18n("Path does not exist") << endl; - return 1; - } - - if (!fileInfo.isDir()) { - out << i18n("Path is not a directory") << endl; - return 1; - } - - auto path = fileInfo.absoluteFilePath(); + QString pathToRemove = args.takeFirst().replace('$HOME', QDir::homePath()); QStringList folders = config.excludeFolders(); - if (!folders.contains(path)) { - out << i18n("%1 is not in the list of exclude folders", path) << endl; + if (!folders.contains(pathToRemove)) { + out << i18n("%1 is not in the list of exclude folders", pathToRemove) << endl; return 1; } - folders.removeAll(path); + folders.removeAll(pathToRemove); config.setExcludeFolders(folders); return 0;