upgrade SDL to version 2.0.8
[platform/upstream/SDL.git] / test / testfilesystem.c
index 838e3b1..ededa54 100755 (executable)
@@ -1,5 +1,5 @@
 /*
-  Copyright (C) 1997-2016 Sam Lantinga <slouken@libsdl.org>
+  Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
 
   This software is provided 'as-is', without any express or implied
   warranty.  In no event will the authors be held liable for any damages
 
 #include <stdio.h>
 #include "SDL.h"
-#ifdef main
-#undef main
-#endif
+
 int
-SDL_main(int argc, char *argv[])
+main(int argc, char *argv[])
 {
     char *base_path;
     char *pref_path;
@@ -26,27 +24,36 @@ SDL_main(int argc, char *argv[])
     SDL_LogSetPriority(SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_PRIORITY_INFO);
 
     if (SDL_Init(0) == -1) {
-        SDLTest_LogError(SDL_LOG_CATEGORY_APPLICATION, "SDL_Init() failed: %s\n", SDL_GetError());
+        SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "SDL_Init() failed: %s\n", SDL_GetError());
         return 1;
     }
 
     base_path = SDL_GetBasePath();
     if(base_path == NULL){
-      SDLTest_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());
-      return 0;
+      return 1;
     }
 
-    SDLTest_Log("base path: '%s'\n", base_path);
+    SDL_Log("base path: '%s'\n", base_path);
     SDL_free(base_path);
 
     pref_path = SDL_GetPrefPath("libsdl", "testfilesystem");
     if(pref_path == NULL){
-      SDLTest_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());
+      return 1;
+    }
+    SDL_Log("pref path: '%s'\n", pref_path); 
+    SDL_free(pref_path);
+
+    pref_path = SDL_GetPrefPath(NULL, "testfilesystem");
+    if(pref_path == NULL){
+      SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't find pref path without organization: %s\n",
                    SDL_GetError());
-      return 0;
+      return 1;
     }
-    SDLTest_Log("pref path: '%s'\n", pref_path); 
+    SDL_Log("pref path: '%s'\n", pref_path); 
     SDL_free(pref_path);
 
     SDL_Quit();