forked from oerkki/voxelands
some path tweaks
This commit is contained in:
parent
92bc8b40fe
commit
64737e32db
|
@ -10,12 +10,13 @@
|
|||
#define USE_MUMBLE @USE_MUMBLE@
|
||||
#define USE_FREETYPE @USE_FREETYPE@
|
||||
#define USE_GETTEXT @USE_GETTEXT@
|
||||
#define DATA_PATH "@SHAREDIR@"
|
||||
#ifdef NDEBUG
|
||||
#define BUILD_TYPE "Release"
|
||||
#else
|
||||
#define BUILD_TYPE "Debug"
|
||||
#endif
|
||||
#define BUILD_INFO "VER="VERSION_STRING" RUN_IN_PLACE=@RUN_IN_PLACE@ USE_GETTEXT=@USE_GETTEXT@ INSTALL_PREFIX=@CMAKE_INSTALL_PREFIX@ BUILD_TYPE="BUILD_TYPE
|
||||
#define BUILD_INFO "VER=" VERSION_STRING " USE_GETTEXT=@USE_GETTEXT@ INSTALL_PREFIX=@CMAKE_INSTALL_PREFIX@ DATA_PATH=" DATA_PATH " BUILD_TYPE=" BUILD_TYPE
|
||||
|
||||
#endif
|
||||
|
||||
|
|
21
src/path.c
21
src/path.c
|
@ -210,7 +210,12 @@ int path_init()
|
|||
char buff[2048];
|
||||
|
||||
#ifndef WIN32
|
||||
|
||||
#ifdef DATA_PATH
|
||||
path.data_global = strdup(DATA_PATH);
|
||||
#else
|
||||
path.data_global = strdup("/usr/games/voxelands");
|
||||
#endif
|
||||
|
||||
if (getcwd(buff,2048)) {
|
||||
path.cwd = strdup(buff);
|
||||
|
@ -276,8 +281,24 @@ int path_init()
|
|||
|
||||
#endif
|
||||
|
||||
if (snprintf(buff,2048,"%s/data",path.cwd) < 2048 && path_check(NULL,buff) == 2) {
|
||||
path.data = strdup(buff);
|
||||
#ifndef WIN32
|
||||
}else{
|
||||
char* a = NULL;
|
||||
char* b = strstr(path.cwd,"/bin");
|
||||
while (b) {
|
||||
a = b;
|
||||
b = strstr(a+1,"/bin");
|
||||
}
|
||||
if (a) {
|
||||
*a = 0;
|
||||
if (snprintf(buff,2048,"%s/data",path.cwd) < 2048 && path_check(NULL,buff) == 2)
|
||||
path.data = strdup(buff);
|
||||
*a = '/';
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue