summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/fs/paths.cpp29
1 files changed, 16 insertions, 13 deletions
diff --git a/src/fs/paths.cpp b/src/fs/paths.cpp
index 22f227650..659fc49e4 100644
--- a/src/fs/paths.cpp
+++ b/src/fs/paths.cpp
@@ -206,21 +206,24 @@ std::string getPicturesDir()
file = pathJoin(xdg, "user-dirs.dirs");
}
- StringVect arr;
- Files::loadTextFileLocal(file, arr);
- FOR_EACH (StringVectCIter, it, arr)
+ if (Files::existsLocal(file))
{
- std::string str = *it;
- if (findCutFirst(str, "XDG_PICTURES_DIR=\""))
+ StringVect arr;
+ Files::loadTextFileLocal(file, arr);
+ FOR_EACH (StringVectCIter, it, arr)
{
- str = str.substr(0, str.size() - 1);
- // use hack to replace $HOME var.
- // if in string other vars, fallback to default path
- replaceAll(str, "$HOME/", VirtFs::getUserDir());
- str = getRealPath(str);
- if (str.empty())
- str = pathJoin(VirtFs::getUserDir(), "Desktop");
- return str;
+ std::string str = *it;
+ if (findCutFirst(str, "XDG_PICTURES_DIR=\""))
+ {
+ str = str.substr(0, str.size() - 1);
+ // use hack to replace $HOME var.
+ // if in string other vars, fallback to default path
+ replaceAll(str, "$HOME/", VirtFs::getUserDir());
+ str = getRealPath(str);
+ if (str.empty())
+ str = pathJoin(VirtFs::getUserDir(), "Desktop");
+ return str;
+ }
}
}
#endif // WIN32