diff --git a/src/common/path.cpp b/src/common/path.cpp index 76a5732a..760cf962 100644 --- a/src/common/path.cpp +++ b/src/common/path.cpp @@ -45,10 +45,19 @@ std::string GetHomeDirectory() return result; #else // catch-all for Linux-based systems - std::string result(".smw/"); - char* folder = getenv("HOME"); - if (folder) - result = std::string(folder) + "/" + result; + std::string result; +#ifdef USE_SDL2 + char* prefPath = SDL_GetPrefPath(nullptr, "supermariowar"); + if (prefPath) { + result = prefPath; + SDL_free(prefPath); + } +#else + char* home = getenv("HOME"); + if (home) { + result = std::string(home) + "/.smw/"; + } +#endif return result; #endif }