1
0
Fork 0
forked from len0rd/rockbox

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:
Jonathan Gordon 2011-12-05 12:07:23 +00:00
parent bac6a70184
commit 6461f74ae4

View file

@ -56,6 +56,7 @@ extern int sim_rename(const char* old, const char* new);
extern DIR* sim_opendir(const char* name);
extern int sim_mkdir(const char* name);
extern int sim_rmdir(const char* name);
const char *rbhome;
#endif
/* flags for get_user_file_path() */
@ -74,13 +75,18 @@ void paths_init(void)
#else
char config_dir[MAX_PATH];
const char *home = getenv("HOME");
const char *home = getenv("RBROOT");
if (!home)
{
home = getenv("HOME");
}
if (!home)
{
logf("HOME environment var not set. Can't write config");
return;
}
rbhome = home;
snprintf(config_dir, sizeof(config_dir), "%s/.config", home);
mkdir(config_dir);
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 (snprintf(buf, bufsize, "/sdcard/rockbox/%s", pos)
#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
>= (int)bufsize)
return NULL;