summaryrefslogtreecommitdiff
path: root/src/fs/paths.cpp
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2017-06-28 21:21:14 +0300
committerAndrei Karas <akaras@inbox.ru>2017-06-28 21:25:56 +0300
commita7c4707ed223f2d0c5a31b2d119d1d92b3d00922 (patch)
tree7a7027d34c0313eb74f9c96e8633d3ea423d59e9 /src/fs/paths.cpp
parente068dbfece05c173f96efbd8767492ed6d5f92a0 (diff)
downloadplus-a7c4707ed223f2d0c5a31b2d119d1d92b3d00922.tar.gz
plus-a7c4707ed223f2d0c5a31b2d119d1d92b3d00922.tar.bz2
plus-a7c4707ed223f2d0c5a31b2d119d1d92b3d00922.tar.xz
plus-a7c4707ed223f2d0c5a31b2d119d1d92b3d00922.zip
Dont show assert if XDG paths config not exists.
Diffstat (limited to 'src/fs/paths.cpp')
-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