SDL  2.0
testfilesystem.c File Reference
#include <stdio.h>
#include "SDL.h"
+ Include dependency graph for testfilesystem.c:

Go to the source code of this file.

Functions

int main (int argc, char *argv[])

Function Documentation

int main ( int  argc,
char *  argv[] 
)

Definition at line 18 of file testfilesystem.c.

References NULL, SDL_free, SDL_GetBasePath(), SDL_GetError, SDL_GetPrefPath, SDL_Init, SDL_Log, SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_PRIORITY_INFO, SDL_LogError, SDL_LogSetPriority, and SDL_Quit.

{
char *base_path;
char *pref_path;
/* Enable standard application logging */
if (SDL_Init(0) == -1) {
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "SDL_Init() failed: %s\n", SDL_GetError());
return 1;
}
base_path = SDL_GetBasePath();
if(base_path == NULL){
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't find base path: %s\n",
return 1;
}
SDL_Log("base path: '%s'\n", base_path);
SDL_free(base_path);
pref_path = SDL_GetPrefPath("libsdl", "testfilesystem");
if(pref_path == NULL){
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't find pref path: %s\n",
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",
return 1;
}
SDL_Log("pref path: '%s'\n", pref_path);
SDL_free(pref_path);
return 0;
}