Files
LLS/include/HomeDirectory.h

14 lines
509 B
C++

#pragma once
#include <filesystem>
/**
* @brief Retrieves the current user's home directory across different operating systems.
*
* On Windows, it checks the USERPROFILE environment variable.
* On Unix/Linux/macOS, it checks the HOME environment variable, with a fallback
* to checking the password database entry (`getpwuid`) if HOME is unset.
*
* @return std::filesystem::path Path to the user's home directory, or an empty path if unable to resolve.
*/
std::filesystem::path getHomeDirectory();