* Finds the Config folder according to the running system. * @return Config path. */
| 273 | * @return Config path. |
| 274 | */ |
| 275 | std::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 |