summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--firmware/common/rbpaths.c10
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);
56extern DIR* sim_opendir(const char* name); 56extern DIR* sim_opendir(const char* name);
57extern int sim_mkdir(const char* name); 57extern int sim_mkdir(const char* name);
58extern int sim_rmdir(const char* name); 58extern int sim_rmdir(const char* name);
59const char *rbhome;
59#endif 60#endif
60 61
61/* flags for get_user_file_path() */ 62/* flags for get_user_file_path() */
@@ -74,13 +75,18 @@ void paths_init(void)
74#else 75#else
75 char config_dir[MAX_PATH]; 76 char config_dir[MAX_PATH];
76 77
77 const char *home = getenv("HOME"); 78 const char *home = getenv("RBROOT");
79 if (!home)
80 {
81 home = getenv("HOME");
82 }
78 if (!home) 83 if (!home)
79 { 84 {
80 logf("HOME environment var not set. Can't write config"); 85 logf("HOME environment var not set. Can't write config");
81 return; 86 return;
82 } 87 }
83 88
89 rbhome = home;
84 snprintf(config_dir, sizeof(config_dir), "%s/.config", home); 90 snprintf(config_dir, sizeof(config_dir), "%s/.config", home);
85 mkdir(config_dir); 91 mkdir(config_dir);
86 snprintf(config_dir, sizeof(config_dir), "%s/.config/rockbox.org", home); 92 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,
120#if (CONFIG_PLATFORM & PLATFORM_ANDROID) 126#if (CONFIG_PLATFORM & PLATFORM_ANDROID)
121 if (snprintf(buf, bufsize, "/sdcard/rockbox/%s", pos) 127 if (snprintf(buf, bufsize, "/sdcard/rockbox/%s", pos)
122#else 128#else
123 if (snprintf(buf, bufsize, "%s/.config/rockbox.org/%s", getenv("HOME"), pos) 129 if (snprintf(buf, bufsize, "%s/.config/rockbox.org/%s", rbhome, pos)
124#endif 130#endif
125 >= (int)bufsize) 131 >= (int)bufsize)
126 return NULL; 132 return NULL;