+ std::string userDataPath;
+#ifdef _WIN32
+ char path[MAX_PATH];
+ // %APPDATA% (%USERPROFILE%\Application Data)
+ if (SUCCEEDED(SHGetFolderPathA(nullptr, CSIDL_APPDATA, nullptr, 0, path))) {
+ userDataPath = std::string(path) + "/Lugaru/";
+ } else {
+ return dataDir;
+ }
+#elif (defined(__APPLE__) && defined(__MACH__))
+ const char* homePath = getHomeDirectory();
+ if (homePath == NULL) {
+ userDataPath = ".";
+ } else {
+ userDataPath = std::string(homePath) + "/Library/Application Support/Lugaru";
+ }
+#else // Linux
+ userDataPath = getGenericDirectory("XDG_DATA_HOME", ".local/share");
+#endif