diff options
Diffstat (limited to 'firmware/target/hosted/filesystem-app.c')
-rw-r--r-- | firmware/target/hosted/filesystem-app.c | 35 |
1 files changed, 18 insertions, 17 deletions
diff --git a/firmware/target/hosted/filesystem-app.c b/firmware/target/hosted/filesystem-app.c index 24c5a7e062..1d64a58677 100644 --- a/firmware/target/hosted/filesystem-app.c +++ b/firmware/target/hosted/filesystem-app.c | |||
@@ -36,15 +36,13 @@ | |||
36 | #include "rbpaths.h" | 36 | #include "rbpaths.h" |
37 | #include "logf.h" | 37 | #include "logf.h" |
38 | 38 | ||
39 | #if !(defined(BOOTLOADER) || defined(CHECKWPS) || defined(SIMULATOR)) | 39 | /* PIVOT_ROOT adds a fixed prefix to all paths */ |
40 | #if defined(HIBY_LINUX) | 40 | #if defined(BOOTLOADER) || defined(CHECKWPS) || defined(SIMULATOR) || defined(__PCTOOL__) |
41 | #define PIVOT_ROOT "/mnt/sd_0" | 41 | /* We don't want to use pivot root on these! */ |
42 | #elif defined(FIIO_M3K) | 42 | #undef PIVOT_ROOT |
43 | #define PIVOT_ROOT "/mnt" // XXX check this! | ||
44 | #else | ||
45 | #endif | 43 | #endif |
46 | #endif // !(BOOTLOADER|WPS|SIM) | ||
47 | 44 | ||
45 | #if defined(HAVE_MULTIDRIVE) || defined(HAVE_SPECIAL_DIRS) | ||
48 | #if (CONFIG_PLATFORM & PLATFORM_ANDROID) | 46 | #if (CONFIG_PLATFORM & PLATFORM_ANDROID) |
49 | static const char rbhome[] = "/sdcard"; | 47 | static const char rbhome[] = "/sdcard"; |
50 | #elif (CONFIG_PLATFORM & (PLATFORM_SDL|PLATFORM_MAEMO|PLATFORM_PANDORA)) \ | 48 | #elif (CONFIG_PLATFORM & (PLATFORM_SDL|PLATFORM_MAEMO|PLATFORM_PANDORA)) \ |
@@ -54,15 +52,11 @@ static const char *rbhome; | |||
54 | /* YPR0, YPR1, NWZ, etc */ | 52 | /* YPR0, YPR1, NWZ, etc */ |
55 | static const char rbhome[] = HOME_DIR; | 53 | static const char rbhome[] = HOME_DIR; |
56 | #endif | 54 | #endif |
55 | #endif | ||
57 | 56 | ||
58 | #if !(defined(SAMSUNG_YPR0) || defined(SAMSUNG_YPR1) || defined(DX50) || \ | 57 | #if !defined(__PCTOOL__) |
59 | defined(SONY_NWZ_LINUX) || defined(DX90) || defined(HIBY_LINUX) || \ | 58 | /* We don't want this for tools */ |
60 | defined(FIIO_M3K)) && \ | 59 | #undef HAVE_SPECIAL_DIRS |
61 | !defined(__PCTOOL__) | ||
62 | /* Special dirs are user-accessible (and user-writable) dirs which take priority | ||
63 | * over the ones where Rockbox is installed to. Classic example would be | ||
64 | * $HOME/.config/rockbox.org vs /usr/share/rockbox */ | ||
65 | #define HAVE_SPECIAL_DIRS | ||
66 | #endif | 60 | #endif |
67 | 61 | ||
68 | #ifdef HAVE_MULTIDRIVE | 62 | #ifdef HAVE_MULTIDRIVE |
@@ -202,6 +196,8 @@ const char * handle_special_dirs(const char *dir, unsigned flags, | |||
202 | { | 196 | { |
203 | (void) flags; (void) buf; (void) bufsize; | 197 | (void) flags; (void) buf; (void) bufsize; |
204 | #ifdef HAVE_SPECIAL_DIRS | 198 | #ifdef HAVE_SPECIAL_DIRS |
199 | #define HOME_DIR_LEN (sizeof(HOME_DIR)-1) | ||
200 | /* This replaces HOME_DIR (ie '<HOME'>') with runtime rbhome */ | ||
205 | if (!strncmp(HOME_DIR, dir, HOME_DIR_LEN)) | 201 | if (!strncmp(HOME_DIR, dir, HOME_DIR_LEN)) |
206 | { | 202 | { |
207 | const char *p = dir + HOME_DIR_LEN; | 203 | const char *p = dir + HOME_DIR_LEN; |
@@ -216,8 +212,13 @@ const char * handle_special_dirs(const char *dir, unsigned flags, | |||
216 | dir = handle_special_links(dir, flags, buf, bufsize); | 212 | dir = handle_special_links(dir, flags, buf, bufsize); |
217 | #endif | 213 | #endif |
218 | #ifdef PIVOT_ROOT | 214 | #ifdef PIVOT_ROOT |
219 | snprintf(buf, bufsize, "%s/%s", PIVOT_ROOT, dir); | 215 | #define PIVOT_ROOT_LEN (sizeof(PIVOT_ROOT)-1) |
220 | dir = buf; | 216 | /* Prepend root prefix to find actual path */ |
217 | if (strncmp(PIVOT_ROOT, dir, PIVOT_ROOT_LEN)) | ||
218 | { | ||
219 | snprintf(buf, bufsize, "%s/%s", PIVOT_ROOT, dir); | ||
220 | dir = buf; | ||
221 | } | ||
221 | #endif | 222 | #endif |
222 | return dir; | 223 | return dir; |
223 | } | 224 | } |