FileSaver: Don't add files in blacklisted paths

We now resolve symlinks when adding, so we can properly check
whether a path is excluded or not. This accidently also
helps with duplicates.

Excluded paths are hardcoded and can also be appended to
by the user using the settings.

Closes: #34
This commit is contained in:
2022-05-29 15:46:06 +02:00
parent 483ea04638
commit b6926d510f
4 changed files with 32 additions and 7 deletions

View File

@ -17,6 +17,7 @@
#define SETTINGS_KEY_FIRSTRUN "firstrun"
#define SETTINGS_KEY_IPCSOCKETPATH "ipcsocketpath"
#define SETTINGS_KEY_PDFVIEWER "pdfviewer"
#define SETTINGS_KEY_EXCLUDEDPATHS "excludedpaths"
inline void initResources()
{
@ -162,3 +163,18 @@ QString Common::ipcSocketPath()
// QSettings settings;
// return settings.value(SETTINGS_KEY_IPCSOCKETPATH, "/tmp/.looqs/looqs-ipc-socket").toString();
}
static QStringList excludedPaths = {"/proc", "/sys", "/dev", "/tmp", "/var/run", "/run"};
QStringList Common::excludedPaths()
{
static int ran = false;
if(!ran)
{
QSettings settings;
QStringList userExcludedPaths = settings.value(SETTINGS_KEY_EXCLUDEDPATHS).toStringList();
ran = true;
::excludedPaths.append(userExcludedPaths);
}
return ::excludedPaths;
}