From b716c9c32870b5eacc9222633eb8c4e4278b6d98 Mon Sep 17 00:00:00 2001 From: bgk Date: Wed, 28 Dec 2011 10:23:38 +0000 Subject: [PATCH] SDL: Install vba-over.ini in the data directory and use it. git-svn-id: https://svn.code.sf.net/p/vbam/code/trunk@1060 a31d4220-a93d-0410-bf67-fe4944624d44 --- CMakeLists.txt | 1 + src/sdl/SDL.cpp | 23 +++++++++++++++-------- 2 files changed, 16 insertions(+), 8 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 5fed46f4..7341a365 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -416,6 +416,7 @@ IF( ENABLE_SDL ) INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/src/sdl/vbam.cfg-example DESTINATION ${SYSCONFDIR} RENAME vbam.cfg) + INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/src/vba-over.ini DESTINATION ${DATA_INSTALL_DIR}) ENDIF( ENABLE_SDL ) IF( ENABLE_GTK ) diff --git a/src/sdl/SDL.cpp b/src/sdl/SDL.cpp index 2c7562cc..987b4ac8 100644 --- a/src/sdl/SDL.cpp +++ b/src/sdl/SDL.cpp @@ -468,14 +468,7 @@ FILE *sdlFindFile(const char *name) if(f != NULL) return f; } -#else // ! _WIN32 - fprintf(stdout, "Searching system config directory: %s\n", SYSCONFDIR); - sprintf(path, "%s%c%s", SYSCONFDIR, FILE_SEP, name); - f = fopen(path, "r"); - if(f != NULL) - return f; -#endif // ! _WIN32 - + if(!strchr(arg0, '/') && !strchr(arg0, '\\')) { char *path = getenv("PATH"); @@ -515,6 +508,20 @@ FILE *sdlFindFile(const char *name) return f; } } +#else // ! _WIN32 + fprintf(stdout, "Searching data directory: %s\n", PKGDATADIR); + sprintf(path, "%s%c%s", PKGDATADIR, FILE_SEP, name); + f = fopen(path, "r"); + if(f != NULL) + return f; + + fprintf(stdout, "Searching system config directory: %s\n", SYSCONFDIR); + sprintf(path, "%s%c%s", SYSCONFDIR, FILE_SEP, name); + f = fopen(path, "r"); + if(f != NULL) + return f; +#endif // ! _WIN32 + return NULL; }