30 #include <sys/types.h>
37 std::filesystem::path executable_path;
41 std::wstring path(MAX_PATH, L
'\0');
42 GetModuleFileNameW(GetModuleHandleW(
nullptr), path.data(), MAX_PATH);
43 path.erase(std::find(path.begin(), path.end(), L
'\0'), path.end());
44 executable_path = path;
48 ssize_t
length = ::readlink(
"/proc/self/exe", path,
sizeof(path) - 1);
52 executable_path = path;
56 return executable_path;
70 std::filesystem::path local_config_path;
74 std::wstring path(MAX_PATH, L
'\0');
75 if (SHGetFolderPathW(
nullptr, CSIDL_LOCAL_APPDATA,
nullptr, SHGFP_TYPE_CURRENT, path.data()) == S_OK)
77 path.erase(std::find(path.begin(), path.end(), L
'\0'), path.end());
78 local_config_path = path;
91 std::filesystem::path home_path = getpwuid(getuid())->pw_dir;
94 char* xdg_config_home = std::getenv(
"XDG_CONFIG_HOME");
99 local_config_path = home_path /
".config/";
103 local_config_path = xdg_config_home;
107 return local_config_path;
113 std::filesystem::path shared_config_path;
115 std::wstring path(MAX_PATH, L
'\0');
116 if (SHGetFolderPathW(
nullptr, CSIDL_APPDATA,
nullptr, SHGFP_TYPE_CURRENT, path.data()) == S_OK)
118 path.erase(std::find(path.begin(), path.end(), L
'\0'), path.end());
119 shared_config_path = path;
130 return shared_config_path;
T length(const quaternion< T > &q)
Calculates the length of a quaternion.
std::filesystem::path get_local_config_path()
Returns the absolute path to the directory containing user-specific, device-specific application data...
std::filesystem::path get_executable_path()
Returns the absolute path to the current executable.
std::filesystem::path get_executable_data_path()
Returns the absolute path to the directory containing application data.
std::filesystem::path get_shared_config_path()
Returns the absolute path to the directory containing user-specific application data that may be shar...