diff options
-rw-r--r-- | src/PlatformUtils-posix.cc | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/src/PlatformUtils-posix.cc b/src/PlatformUtils-posix.cc index d7b7b6d..d2b8792 100644 --- a/src/PlatformUtils-posix.cc +++ b/src/PlatformUtils-posix.cc @@ -3,8 +3,13 @@ std::string PlatformUtils::documentsPath() { - fs::path docpath(getenv("HOME")); - docpath = docpath / ".local" / "share"; - - return boosty::stringy(docpath); + const char *home = getenv("HOME"); + if (home) { + fs::path docpath(home); + docpath = docpath / ".local" / "share"; + return boosty::stringy(docpath); + } + else { + return ""; + } } |