Added ostd::Utils::getHomeDirPath function to <FileSystem.hpp>

This commit is contained in:
OmniaX-dev 2024-05-08 12:47:53 +02:00
parent 7ca2fbf3f1
commit d63db08081
3 changed files with 15 additions and 1 deletions

View file

@ -1 +1 @@
1854
1855

View file

@ -61,5 +61,18 @@ namespace ostd
list.push_back(file.path());
return list;
}
ostd::String Utils::getHomeDirPath(void)
{
ostd::String home_path = "";
#ifdef WINDOWS_OS
home_path = ostd::String(getenv("HOMEDRIVE")) + "\\" + ostd::String(getenv("HOMEPATH"));
#elif defined(LINUX_OS)
home_path = ostd::String(getenv("HOME"));
#else
home_path = "NULL";
#endif
return home_path;
}
}

View file

@ -157,6 +157,7 @@ namespace ostd
static std::vector<std::filesystem::path> listFilesInDirectoryRecursive(const String& directoryPath);
static std::vector<std::filesystem::path> listDirectoriesInDirectoryRecursive(const String& directoryPath);
static std::vector<std::filesystem::path> listDirectoryRecursive(const String& directoryPath);
static ostd::String getHomeDirPath(void);
//Implemented in <ShuntingYard.cpp>
static int32_t solveIntegerExpression(const String& expr);