diff options
author | Jonathan Gordon <rockbox@jdgordon.info> | 2011-12-05 12:07:23 +0000 |
---|---|---|
committer | Jonathan Gordon <rockbox@jdgordon.info> | 2011-12-05 12:07:23 +0000 |
commit | 6461f74ae450ce0c834b3d4c7da134f0fefed945 (patch) | |
tree | cfa92a3dd99be6273613750040b829c9c846a130 | |
parent | bac6a70184b18ca17a46b3ed955944e1a4d3f032 (diff) |
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
-rw-r--r-- | firmware/common/rbpaths.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/firmware/common/rbpaths.c b/firmware/common/rbpaths.c index 1bbed97d21..ed413eb03e 100644 --- a/firmware/common/rbpaths.c +++ b/firmware/common/rbpaths.c @@ -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; |