| 150 | } |
| 151 | |
| 152 | FilesystemView Game_Config::GetGlobalConfigFilesystem() { |
| 153 | // FIXME: Game specific configs? |
| 154 | std::string path; |
| 155 | |
| 156 | if (config_path.empty()) { |
| 157 | #ifdef __wii__ |
| 158 | path = "/data/easyrpg-player"; |
| 159 | #elif defined(__WIIU__) |
| 160 | path = "fs:/vol/external01/wiiu/data/easyrpg-player"; |
| 161 | #elif defined(__SWITCH__) |
| 162 | path = "/switch/easyrpg-player"; |
| 163 | #elif defined(__3DS__) |
| 164 | path = "sdmc:/data/easyrpg-player"; |
| 165 | #elif defined(__vita__) |
| 166 | path = "ux0:/data/easyrpg-player"; |
| 167 | #elif defined(USE_LIBRETRO) |
| 168 | const char* dir = nullptr; |
| 169 | if (LibretroUi::environ_cb(RETRO_ENVIRONMENT_GET_SYSTEM_DIRECTORY, &dir) && dir) { |
| 170 | path = FileFinder::MakePath(dir, "easyrpg-player"); |
| 171 | } |
| 172 | #elif defined(__ANDROID__) |
| 173 | // Never called, passed as argument on startup |
| 174 | #elif defined(_WIN32) |
| 175 | PWSTR knownPath; |
| 176 | const auto hresult = SHGetKnownFolderPath(FOLDERID_RoamingAppData, 0, nullptr, &knownPath); |
| 177 | if (SUCCEEDED(hresult)) { |
| 178 | path = Utils::FromWideString(knownPath); |
| 179 | CoTaskMemFree(knownPath); |
| 180 | } else { |
| 181 | Output::Debug("Config: SHGetKnownFolderPath failed"); |
| 182 | } |
| 183 | |
| 184 | if (!path.empty()) { |
| 185 | path = FileFinder::MakePath(path, FileFinder::MakePath(ORGANIZATION_NAME, APPLICATION_NAME)); |
| 186 | } |
| 187 | #else |
| 188 | char* home = getenv("XDG_CONFIG_HOME"); |
| 189 | if (home) { |
| 190 | path = home; |
| 191 | } else { |
| 192 | home = getenv("HOME"); |
| 193 | if (home) { |
| 194 | path = FileFinder::MakePath(home, ".config"); |
| 195 | } |
| 196 | } |
| 197 | |
| 198 | if (!path.empty()) { |
| 199 | path = FileFinder::MakePath(path, FileFinder::MakePath(ORGANIZATION_NAME, APPLICATION_NAME)); |
| 200 | } |
| 201 | #endif |
| 202 | } else { |
| 203 | path = config_path; |
| 204 | } |
| 205 | |
| 206 | auto print_err = [&path]() { |
| 207 | if (path.empty()) { |
| 208 | Output::Warning("Could not determine config path"); |
| 209 | } else { |
nothing calls this directly
no test coverage detected