mirror of
https://gitlab.com/dosowisko.net/libsuperderpy.git
synced 2025-02-01 11:06:44 +01:00
GetDataFilePath: change order of lookup paths and remove "../data"
This commit is contained in:
parent
a3cda7ba50
commit
56ea82d526
1 changed files with 13 additions and 15 deletions
26
src/utils.c
26
src/utils.c
|
@ -287,29 +287,27 @@ SYMBOL_EXPORT char* GetGameName(struct Game* game, char* format) {
|
||||||
static char* TestDataFilePath(struct Game* game, char* filename) {
|
static char* TestDataFilePath(struct Game* game, char* filename) {
|
||||||
char* result = NULL;
|
char* result = NULL;
|
||||||
|
|
||||||
if (al_filename_exists(filename)) {
|
TestPath(filename, "data/", &result);
|
||||||
return strdup(filename);
|
TestPath(filename, GetGameName(game, "../share/%s/data/"), &result);
|
||||||
|
|
||||||
|
#ifdef ALLEGRO_MACOSX
|
||||||
|
TestPath(filename, "../Resources/data/", &result);
|
||||||
|
TestPath(filename, "../Resources/gamestates/", &result);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
if (result) {
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
// try current working directory if everything else fails
|
||||||
char origfn[255] = "data/";
|
char origfn[255] = "data/";
|
||||||
strncat(origfn, filename, 249);
|
strncat(origfn, filename, 249);
|
||||||
|
|
||||||
if (al_filename_exists(origfn)) {
|
if (al_filename_exists(origfn)) {
|
||||||
return strdup(origfn);
|
return strdup(origfn);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
TestPath(filename, "data/", &result);
|
return NULL;
|
||||||
TestPath(filename, GetGameName(game, "../share/%s/data/"), &result);
|
|
||||||
|
|
||||||
TestPath(filename, "../data/", &result);
|
|
||||||
#ifdef ALLEGRO_MACOSX
|
|
||||||
TestPath(filename, "../Resources/data/", &result);
|
|
||||||
TestPath(filename, "../Resources/gamestates/", &result);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
return result;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
SYMBOL_EXPORT char* GetDataFilePath(struct Game* game, char* filename) {
|
SYMBOL_EXPORT char* GetDataFilePath(struct Game* game, char* filename) {
|
||||||
|
|
Loading…
Reference in a new issue