testfilesystem: Don't exit the application if SDL_GetBasePath isn't supported

This commit is contained in:
Cameron Cawley 2020-02-13 22:58:04 +00:00
parent 35704c983e
commit 033aa51d87
1 changed files with 9 additions and 9 deletions

View File

@ -32,28 +32,28 @@ main(int argc, char *argv[])
if(base_path == NULL){ if(base_path == NULL){
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't find base path: %s\n", SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't find base path: %s\n",
SDL_GetError()); SDL_GetError());
return 1; } else {
}
SDL_Log("base path: '%s'\n", base_path); SDL_Log("base path: '%s'\n", base_path);
SDL_free(base_path); SDL_free(base_path);
}
pref_path = SDL_GetPrefPath("libsdl", "testfilesystem"); pref_path = SDL_GetPrefPath("libsdl", "testfilesystem");
if(pref_path == NULL){ if(pref_path == NULL){
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't find pref path: %s\n", SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't find pref path: %s\n",
SDL_GetError()); SDL_GetError());
return 1; } else {
}
SDL_Log("pref path: '%s'\n", pref_path); SDL_Log("pref path: '%s'\n", pref_path);
SDL_free(pref_path); SDL_free(pref_path);
}
pref_path = SDL_GetPrefPath(NULL, "testfilesystem"); pref_path = SDL_GetPrefPath(NULL, "testfilesystem");
if(pref_path == NULL){ if(pref_path == NULL){
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't find pref path without organization: %s\n", SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't find pref path without organization: %s\n",
SDL_GetError()); SDL_GetError());
return 1; } else {
}
SDL_Log("pref path: '%s'\n", pref_path); SDL_Log("pref path: '%s'\n", pref_path);
SDL_free(pref_path); SDL_free(pref_path);
}
SDL_Quit(); SDL_Quit();
return 0; return 0;