mirror of
https://gitlab.com/dosowisko.net/libsuperderpy.git
synced 2024-12-12 12:08:00 +01:00
GetDataFilePathNull
This commit is contained in:
parent
5eeba6ec45
commit
5839a6a59a
2 changed files with 33 additions and 0 deletions
32
src/utils.c
32
src/utils.c
|
@ -320,6 +320,38 @@ SYMBOL_EXPORT char* GetDataFilePath(struct Game *game, char* filename) {
|
|||
return AddGarbage(game, result);
|
||||
}
|
||||
|
||||
SYMBOL_EXPORT char* GetDataFilePathNull(struct Game *game, char* filename) {
|
||||
|
||||
char *result = 0;
|
||||
|
||||
if (al_filename_exists(filename)) {
|
||||
return AddGarbage(game, strdup(filename));
|
||||
}
|
||||
|
||||
{
|
||||
char origfn[255] = "data/";
|
||||
strcat(origfn, filename);
|
||||
|
||||
if (al_filename_exists(origfn)) {
|
||||
return AddGarbage(game, strdup(origfn));
|
||||
}
|
||||
}
|
||||
|
||||
TestPath(filename, "data/", &result);
|
||||
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
|
||||
|
||||
if (!result) {
|
||||
return filename;
|
||||
}
|
||||
return AddGarbage(game, result);
|
||||
}
|
||||
|
||||
ALLEGRO_DEBUG_CHANNEL("libsuperderpy")
|
||||
|
||||
SYMBOL_EXPORT void PrintConsole(struct Game *game, char* format, ...) {
|
||||
|
|
|
@ -55,6 +55,7 @@ ALLEGRO_BITMAP* LoadScaledBitmap(struct Game *game, char* filename, int width, i
|
|||
|
||||
/*! \brief Finds path for data file. */
|
||||
char* GetDataFilePath(struct Game *game, char* filename);
|
||||
char* GetDataFilePathNull(struct Game *game, char* filename);
|
||||
|
||||
char* GetGameName(struct Game *game, char* format);
|
||||
|
||||
|
|
Loading…
Reference in a new issue