MCPcopy Create free account
hub / github.com/OpenXcom/OpenXcom / findConfigFolder

Function findConfigFolder

src/Engine/CrossPlatform.cpp:275–300  ·  view source on GitHub ↗

* Finds the Config folder according to the running system. * @return Config path. */

Source from the content-addressed store, hash-verified

273 * @return Config path.
274 */
275std::string findConfigFolder()
276{
277#ifdef __MORPHOS__
278 return "PROGDIR:";
279#endif
280
281#if defined(_WIN32) || defined(__APPLE__)
282 return "";
283#elif defined (__HAIKU__)
284 return "/boot/home/config/settings/openxcom/";
285#else
286 char const *home = getHome();
287 char path[MAXPATHLEN];
288 // Get config folders
289 if (char const *const xdg_config_home = getenv("XDG_CONFIG_HOME"))
290 {
291 snprintf(path, MAXPATHLEN, "%s/openxcom/", xdg_config_home);
292 return path;
293 }
294 else
295 {
296 snprintf(path, MAXPATHLEN, "%s/.config/openxcom/", home);
297 return path;
298 }
299#endif
300}
301
302/**
303 * Takes a path and tries to find it based on the

Callers 1

setFoldersFunction · 0.85

Calls 1

getHomeFunction · 0.85

Tested by

no test coverage detected