diff options
author | Andrei Karas <akaras@inbox.ru> | 2017-06-28 21:21:14 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2017-06-28 21:25:56 +0300 |
commit | a7c4707ed223f2d0c5a31b2d119d1d92b3d00922 (patch) | |
tree | 7a7027d34c0313eb74f9c96e8633d3ea423d59e9 /src | |
parent | e068dbfece05c173f96efbd8767492ed6d5f92a0 (diff) | |
download | ManaVerse-a7c4707ed223f2d0c5a31b2d119d1d92b3d00922.tar.gz ManaVerse-a7c4707ed223f2d0c5a31b2d119d1d92b3d00922.tar.bz2 ManaVerse-a7c4707ed223f2d0c5a31b2d119d1d92b3d00922.tar.xz ManaVerse-a7c4707ed223f2d0c5a31b2d119d1d92b3d00922.zip |
Dont show assert if XDG paths config not exists.
Diffstat (limited to 'src')
-rw-r--r-- | src/fs/paths.cpp | 29 |
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 |