mirror of
https://github.com/Rockbox/rockbox.git
synced 2025-10-27 15:56:18 -04:00
Try $RBROOT before $HOME when looking for the sdl apps rockbox root dir
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@31151 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
parent
bac6a70184
commit
6461f74ae4
1 changed files with 8 additions and 2 deletions
|
|
@ -56,6 +56,7 @@ extern int sim_rename(const char* old, const char* new);
|
||||||
extern DIR* sim_opendir(const char* name);
|
extern DIR* sim_opendir(const char* name);
|
||||||
extern int sim_mkdir(const char* name);
|
extern int sim_mkdir(const char* name);
|
||||||
extern int sim_rmdir(const char* name);
|
extern int sim_rmdir(const char* name);
|
||||||
|
const char *rbhome;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* flags for get_user_file_path() */
|
/* flags for get_user_file_path() */
|
||||||
|
|
@ -74,13 +75,18 @@ void paths_init(void)
|
||||||
#else
|
#else
|
||||||
char config_dir[MAX_PATH];
|
char config_dir[MAX_PATH];
|
||||||
|
|
||||||
const char *home = getenv("HOME");
|
const char *home = getenv("RBROOT");
|
||||||
|
if (!home)
|
||||||
|
{
|
||||||
|
home = getenv("HOME");
|
||||||
|
}
|
||||||
if (!home)
|
if (!home)
|
||||||
{
|
{
|
||||||
logf("HOME environment var not set. Can't write config");
|
logf("HOME environment var not set. Can't write config");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
rbhome = home;
|
||||||
snprintf(config_dir, sizeof(config_dir), "%s/.config", home);
|
snprintf(config_dir, sizeof(config_dir), "%s/.config", home);
|
||||||
mkdir(config_dir);
|
mkdir(config_dir);
|
||||||
snprintf(config_dir, sizeof(config_dir), "%s/.config/rockbox.org", home);
|
snprintf(config_dir, sizeof(config_dir), "%s/.config/rockbox.org", home);
|
||||||
|
|
@ -120,7 +126,7 @@ static const char* _get_user_file_path(const char *path,
|
||||||
#if (CONFIG_PLATFORM & PLATFORM_ANDROID)
|
#if (CONFIG_PLATFORM & PLATFORM_ANDROID)
|
||||||
if (snprintf(buf, bufsize, "/sdcard/rockbox/%s", pos)
|
if (snprintf(buf, bufsize, "/sdcard/rockbox/%s", pos)
|
||||||
#else
|
#else
|
||||||
if (snprintf(buf, bufsize, "%s/.config/rockbox.org/%s", getenv("HOME"), pos)
|
if (snprintf(buf, bufsize, "%s/.config/rockbox.org/%s", rbhome, pos)
|
||||||
#endif
|
#endif
|
||||||
>= (int)bufsize)
|
>= (int)bufsize)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue