aboutsummaryrefslogtreecommitdiff
path: root/zenserver/config.cpp
diff options
context:
space:
mode:
authorMartin Ridgers <[email protected]>2021-11-17 15:31:34 +0100
committerMartin Ridgers <[email protected]>2021-11-17 15:31:34 +0100
commitcb198c80ae7fa4916375ba8acb5a5485067447b2 (patch)
tree981284d754d26398662f141c6cae3e6397a022c9 /zenserver/config.cpp
parentPost-merge compile fixes (diff)
downloadzen-cb198c80ae7fa4916375ba8acb5a5485067447b2.tar.xz
zen-cb198c80ae7fa4916375ba8acb5a5485067447b2.zip
Use syscalls to get user path as '~' is only an alias to shells
Diffstat (limited to 'zenserver/config.cpp')
-rw-r--r--zenserver/config.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/zenserver/config.cpp b/zenserver/config.cpp
index 7afac3406..9f24f534c 100644
--- a/zenserver/config.cpp
+++ b/zenserver/config.cpp
@@ -18,6 +18,8 @@ ZEN_THIRD_PARTY_INCLUDES_END
#if ZEN_PLATFORM_WINDOWS
# include <conio.h>
+#else
+# include <pwd.h>
#endif
#if ZEN_PLATFORM_WINDOWS
@@ -53,7 +55,9 @@ PickDefaultStateDirectory()
std::filesystem::path
PickDefaultStateDirectory()
{
- return std::filesystem::path("~/.zen");
+ int UserId = getuid();
+ const passwd* Passwd = getpwuid(UserId);
+ return std::filesystem::path(Passwd->pw_dir) / ".zen";
}
#endif