char* GetEnvironmentSubPath(char* name, const char* path) { char* env; char* subpath; env = GetEnvironmentPath(name); if (!env) return NULL; subpath = GetCombinedPath(env, path); free(env); return subpath; }
std::string GetFolderPath(SPECIAL_FOLDER folder) { switch (folder) { case SPECIAL_FOLDER::USER_CACHE: case SPECIAL_FOLDER::USER_CONFIG: case SPECIAL_FOLDER::USER_DATA: { auto path = GetEnvironmentPath("XDG_CONFIG_HOME"); if (path.empty()) { auto home = GetFolderPath(SPECIAL_FOLDER::USER_HOME); path = Path::Combine(home, ".config"); } return path; } case SPECIAL_FOLDER::USER_HOME: return GetHomePath(); default: return std::string(); } }