mirror of
https://github.com/libsdl-org/SDL.git
synced 2025-09-30 23:18:29 +00:00
filesystem: SDL_GetPrefPath() now follows the SDL_GetStringRule.
Reference Issue #10229.
This commit is contained in:
@@ -429,6 +429,15 @@ const char *SDL_GetUserFolder(SDL_Folder folder)
|
||||
}
|
||||
|
||||
|
||||
const char *SDL_GetPrefPath(const char *org, const char *app)
|
||||
{
|
||||
char *path = SDL_SYS_GetPrefPath(org, app);
|
||||
if (path) {
|
||||
SDL_FreeLater(path);
|
||||
}
|
||||
return path;
|
||||
}
|
||||
|
||||
|
||||
void SDL_InitFilesystem(void)
|
||||
{
|
||||
|
@@ -24,6 +24,7 @@
|
||||
|
||||
// return a string that we can SDL_free(). It will be cached at the higher level.
|
||||
extern char *SDL_SYS_GetBasePath(void);
|
||||
extern char *SDL_SYS_GetPrefPath(const char *org, const char *app);
|
||||
extern char *SDL_SYS_GetUserFolder(SDL_Folder folder);
|
||||
|
||||
int SDL_SYS_EnumerateDirectory(const char *path, const char *dirname, SDL_EnumerateDirectoryCallback cb, void *userdata);
|
||||
|
@@ -34,7 +34,7 @@ char *SDL_SYS_GetBasePath(void)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
char *SDL_GetPrefPath(const char *org, const char *app)
|
||||
char *SDL_SYS_GetPrefPath(const char *org, const char *app)
|
||||
{
|
||||
const char *path = SDL_GetAndroidInternalStoragePath();
|
||||
if (path) {
|
||||
|
@@ -61,7 +61,7 @@ char *SDL_SYS_GetBasePath(void)
|
||||
}
|
||||
}
|
||||
|
||||
char *SDL_GetPrefPath(const char *org, const char *app)
|
||||
char *SDL_SYS_GetPrefPath(const char *org, const char *app)
|
||||
{
|
||||
@autoreleasepool {
|
||||
char *retval = NULL;
|
||||
|
@@ -31,7 +31,7 @@ char *SDL_SYS_GetBasePath(void)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
char *SDL_GetPrefPath(const char *org, const char *app)
|
||||
char *SDL_SYS_GetPrefPath(const char *org, const char *app)
|
||||
{
|
||||
SDL_Unsupported();
|
||||
return NULL;
|
||||
|
@@ -34,7 +34,7 @@ char *SDL_SYS_GetBasePath(void)
|
||||
return SDL_strdup("/");
|
||||
}
|
||||
|
||||
char *SDL_GetPrefPath(const char *org, const char *app)
|
||||
char *SDL_SYS_GetPrefPath(const char *org, const char *app)
|
||||
{
|
||||
const char *append = "/libsdl/";
|
||||
char *retval;
|
||||
|
@@ -79,8 +79,7 @@ SDL_SYS_GetBasePath(void)
|
||||
return path;
|
||||
}
|
||||
|
||||
char *
|
||||
SDL_GetPrefPath(const char *org, const char *app)
|
||||
char *SDL_SYS_GetPrefPath(const char *org, const char *app)
|
||||
{
|
||||
XUserHandle user = NULL;
|
||||
XAsyncBlock block = { 0 };
|
||||
|
@@ -65,7 +65,7 @@ char *SDL_SYS_GetBasePath(void)
|
||||
}
|
||||
|
||||
|
||||
char *SDL_GetPrefPath(const char *org, const char *app)
|
||||
char *SDL_SYS_GetPrefPath(const char *org, const char *app)
|
||||
{
|
||||
// !!! FIXME: is there a better way to do this?
|
||||
const char *home = SDL_getenv("HOME");
|
||||
|
@@ -38,7 +38,7 @@ char *SDL_SYS_GetBasePath(void)
|
||||
return base_path;
|
||||
}
|
||||
|
||||
char *SDL_GetPrefPath(const char *org, const char *app)
|
||||
char *SDL_SYS_GetPrefPath(const char *org, const char *app)
|
||||
{
|
||||
char *pref_path = NULL;
|
||||
if (!app) {
|
||||
|
@@ -73,7 +73,7 @@ static void recursive_mkdir(const char *dir)
|
||||
mkdir(tmp, S_IRWXU);
|
||||
}
|
||||
|
||||
char *SDL_GetPrefPath(const char *org, const char *app)
|
||||
char *SDL_SYS_GetPrefPath(const char *org, const char *app)
|
||||
{
|
||||
char *retval = NULL;
|
||||
size_t len;
|
||||
|
@@ -44,7 +44,7 @@ char *SDL_SYS_GetBasePath(void)
|
||||
return retval;
|
||||
}
|
||||
|
||||
char *SDL_GetPrefPath(const char *org, const char *app)
|
||||
char *SDL_SYS_GetPrefPath(const char *org, const char *app)
|
||||
{
|
||||
char *retval = NULL;
|
||||
size_t len;
|
||||
|
@@ -150,7 +150,7 @@ char *SDL_SYS_GetBasePath(void)
|
||||
return retval;
|
||||
}
|
||||
|
||||
char *SDL_GetPrefPath(const char *org, const char *app)
|
||||
char *SDL_SYS_GetPrefPath(const char *org, const char *app)
|
||||
{
|
||||
char *canon, *dir, *retval;
|
||||
size_t len;
|
||||
|
@@ -253,7 +253,7 @@ char *SDL_SYS_GetBasePath(void)
|
||||
return retval;
|
||||
}
|
||||
|
||||
char *SDL_GetPrefPath(const char *org, const char *app)
|
||||
char *SDL_SYS_GetPrefPath(const char *org, const char *app)
|
||||
{
|
||||
/*
|
||||
* We use XDG's base directory spec, even if you're not on Linux.
|
||||
|
@@ -39,7 +39,7 @@ char *SDL_SYS_GetBasePath(void)
|
||||
return SDL_strdup("app0:/");
|
||||
}
|
||||
|
||||
char *SDL_GetPrefPath(const char *org, const char *app)
|
||||
char *SDL_SYS_GetPrefPath(const char *org, const char *app)
|
||||
{
|
||||
const char *envr = "ux0:/data/";
|
||||
char *retval = NULL;
|
||||
|
@@ -90,7 +90,7 @@ char *SDL_SYS_GetBasePath(void)
|
||||
return retval;
|
||||
}
|
||||
|
||||
char *SDL_GetPrefPath(const char *org, const char *app)
|
||||
char *SDL_SYS_GetPrefPath(const char *org, const char *app)
|
||||
{
|
||||
/*
|
||||
* Vista and later has a new API for this, but SHGetFolderPath works there,
|
||||
|
@@ -137,7 +137,7 @@ extern "C" char *SDL_SYS_GetBasePath(void)
|
||||
return destPath;
|
||||
}
|
||||
|
||||
extern "C" char *SDL_GetPrefPath(const char *org, const char *app)
|
||||
extern "C" char *SDL_SYS_GetPrefPath(const char *org, const char *app)
|
||||
{
|
||||
/* WinRT note: The 'SHGetFolderPath' API that is used in Windows 7 and
|
||||
* earlier is not available on WinRT or Windows Phone. WinRT provides
|
||||
|
Reference in New Issue
Block a user