aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/zencore/filesystem.cpp8
-rw-r--r--src/zencore/include/zencore/filesystem.h1
2 files changed, 9 insertions, 0 deletions
diff --git a/src/zencore/filesystem.cpp b/src/zencore/filesystem.cpp
index 52f2c4adc..3aa2dd0e1 100644
--- a/src/zencore/filesystem.cpp
+++ b/src/zencore/filesystem.cpp
@@ -1755,6 +1755,14 @@ PickDefaultSystemRootDirectory()
#endif // ZEN_PLATFORM_WINDOWS
}
+std::filesystem::path
+GetUserHomeFolder()
+{
+ int UserId = getuid();
+ const passwd* Passwd = getpwuid(UserId);
+ return std::filesystem::path(Passwd->pw_dir);
+}
+
//////////////////////////////////////////////////////////////////////////
//
// Testing related code follows...
diff --git a/src/zencore/include/zencore/filesystem.h b/src/zencore/include/zencore/filesystem.h
index dba4981f0..13b7521ca 100644
--- a/src/zencore/include/zencore/filesystem.h
+++ b/src/zencore/include/zencore/filesystem.h
@@ -226,6 +226,7 @@ std::error_code RotateFiles(const std::filesystem::path& Filename, std::size_t M
std::error_code RotateDirectories(const std::filesystem::path& DirectoryName, std::size_t MaxDirectories);
std::filesystem::path PickDefaultSystemRootDirectory();
+std::filesystem::path GetUserHomeFolder();
//////////////////////////////////////////////////////////////////////////