1 // --------------------------------------------------------
3 // --------------------------------------------------------
4 // Copyright (c) 2003, 2004, Kronoman
5 // In loving memory of my father
6 // --------------------------------------------------------
7 // I use this for reach the datafile searching in common paths
8 // Is specially useful for datafiles in Windows, because most
9 // of the time Windows don't start the program in the executable path,
10 // and the program is unable to find the datafile.
11 // --------------------------------------------------------
17 // --------------------------------------------------------
18 // This checks for the filename in several places.
19 // Returns where the filename is located in buffer
20 // buffer should be a 2048 bytes char
21 // If the file is not found, return the filename...
22 // --------------------------------------------------------
23 char *where_is_the_filename(char *buffer
, const char *filename
)
25 char str
[2048], str2
[2048]; // buffer for path making
27 // check in current executable path
28 get_executable_name(str
, 2048);
29 replace_filename(str2
, str
, filename
, 2048);
31 if (! exists(filename
) )
35 usprintf(buffer
,"%s", str2
);
37 //printf("--> %s\n", buffer);
43 get_executable_name(str
, 2048);
44 replace_filename(str
, str
, "", 2048);
45 if (! find_allegro_resource(str2
, filename
, get_extension(filename
), NULL
, NULL
, NULL
, str
, 2048) )
47 usprintf(buffer
,"%s", str2
);
49 //printf("--> %s\n", buffer);
57 usprintf(buffer
,"%s", filename
);
59 //printf("--> %s\n", buffer);