aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorDan Engelbrecht <[email protected]>2025-01-10 09:56:33 +0100
committerDan Engelbrecht <[email protected]>2025-01-10 09:56:33 +0100
commitbe24af604c26cca81d4b6d4f1789238884c7a12d (patch)
tree670f0552468398e6c60edfe2c8667275feb34e90 /src
parentpartial macos implementation (diff)
downloadzen-be24af604c26cca81d4b6d4f1789238884c7a12d.tar.xz
zen-be24af604c26cca81d4b6d4f1789238884c7a12d.zip
get home folder
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();
//////////////////////////////////////////////////////////////////////////