mirror of
https://github.com/libsdl-org/SDL.git
synced 2025-05-28 07:29:09 +00:00
filesystem: SDL_GetBasePath() now follows the SDL_GetStringRule.
It also now caches at the higher level, so the platform-specific bits don't change their interface much. A little code hygiene work was applied to some of the platform bits on top of this. Reference Issue #10229.
This commit is contained in:
parent
d65a8146b9
commit
3bc81a81f5
24 changed files with 137 additions and 69 deletions
|
@ -23,11 +23,9 @@
|
|||
char *
|
||||
GetNearbyFilename(const char *file)
|
||||
{
|
||||
char *base;
|
||||
const char *base = SDL_GetBasePath();
|
||||
char *path;
|
||||
|
||||
base = SDL_GetBasePath();
|
||||
|
||||
if (base) {
|
||||
SDL_IOStream *rw;
|
||||
size_t len = SDL_strlen(base) + SDL_strlen(file) + 1;
|
||||
|
@ -35,12 +33,10 @@ GetNearbyFilename(const char *file)
|
|||
path = SDL_malloc(len);
|
||||
|
||||
if (!path) {
|
||||
SDL_free(base);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
(void)SDL_snprintf(path, len, "%s%s", base, file);
|
||||
SDL_free(base);
|
||||
|
||||
rw = SDL_IOFromFile(path, "rb");
|
||||
if (rw) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue