diff options
Diffstat (limited to 'firmware/target/hosted/filesystem-app.c')
-rw-r--r-- | firmware/target/hosted/filesystem-app.c | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/firmware/target/hosted/filesystem-app.c b/firmware/target/hosted/filesystem-app.c index 16ad5e312f..93057e7a83 100644 --- a/firmware/target/hosted/filesystem-app.c +++ b/firmware/target/hosted/filesystem-app.c | |||
@@ -8,6 +8,7 @@ | |||
8 | * $Id$ | 8 | * $Id$ |
9 | * | 9 | * |
10 | * Copyright (C) 2010 Thomas Martitz | 10 | * Copyright (C) 2010 Thomas Martitz |
11 | * Copyright (C) 2020 Solomon Peachy | ||
11 | * | 12 | * |
12 | * This program is free software; you can redistribute it and/or | 13 | * This program is free software; you can redistribute it and/or |
13 | * modify it under the terms of the GNU General Public License | 14 | * modify it under the terms of the GNU General Public License |
@@ -53,8 +54,10 @@ static const char rbhome[] = "/sdcard"; | |||
53 | #elif (CONFIG_PLATFORM & (PLATFORM_SDL|PLATFORM_MAEMO|PLATFORM_PANDORA)) \ | 54 | #elif (CONFIG_PLATFORM & (PLATFORM_SDL|PLATFORM_MAEMO|PLATFORM_PANDORA)) \ |
54 | && !defined(__PCTOOL__) | 55 | && !defined(__PCTOOL__) |
55 | static const char *rbhome; | 56 | static const char *rbhome; |
57 | #elif defined(PIVOT_ROOT) | ||
58 | static const char rbhome[] = PIVOT_ROOT; | ||
56 | #else | 59 | #else |
57 | /* YPR0, YPR1, NWZ, etc */ | 60 | /* Anything else? */ |
58 | static const char rbhome[] = HOME_DIR; | 61 | static const char rbhome[] = HOME_DIR; |
59 | #endif | 62 | #endif |
60 | #endif | 63 | #endif |
@@ -94,9 +97,7 @@ static const char *handle_special_links(const char* link, unsigned flags, | |||
94 | 97 | ||
95 | return link; | 98 | return link; |
96 | } | 99 | } |
97 | #endif | ||
98 | 100 | ||
99 | #ifdef HAVE_MULTIDRIVE | ||
100 | /* we keep an open descriptor of the home directory to detect when it has been | 101 | /* we keep an open descriptor of the home directory to detect when it has been |
101 | opened by opendir() so that its "symlinks" may be enumerated */ | 102 | opened by opendir() so that its "symlinks" may be enumerated */ |
102 | static void cleanup_rbhome(void) | 103 | static void cleanup_rbhome(void) |
@@ -209,12 +210,19 @@ const char * handle_special_dirs(const char *dir, unsigned flags, | |||
209 | dir = _get_user_file_path(dir, flags, buf, bufsize); | 210 | dir = _get_user_file_path(dir, flags, buf, bufsize); |
210 | #endif | 211 | #endif |
211 | #ifdef HAVE_MULTIDRIVE | 212 | #ifdef HAVE_MULTIDRIVE |
213 | #define MULTIDRIVE_DIR_LEN (sizeof(MULTIDRIVE_DIR)-1) | ||
214 | |||
212 | dir = handle_special_links(dir, flags, buf, bufsize); | 215 | dir = handle_special_links(dir, flags, buf, bufsize); |
213 | #endif | 216 | #endif |
214 | #ifdef PIVOT_ROOT | 217 | #ifdef PIVOT_ROOT |
215 | #define PIVOT_ROOT_LEN (sizeof(PIVOT_ROOT)-1) | 218 | #define PIVOT_ROOT_LEN (sizeof(PIVOT_ROOT)-1) |
216 | /* Prepend root prefix to find actual path */ | 219 | /* Prepend root prefix to find actual path */ |
217 | if (strncmp(PIVOT_ROOT, dir, PIVOT_ROOT_LEN)) | 220 | if (strncmp(PIVOT_ROOT, dir, PIVOT_ROOT_LEN) |
221 | #ifdef MULTIDRIVE_DIR | ||
222 | /* Unless it's a MULTIDRIVE dir, in which case use as-is */ | ||
223 | && strncmp(MULTIDRIVE_DIR, dir, MULTIDRIVE_DIR_LEN) | ||
224 | #endif | ||
225 | ) | ||
218 | { | 226 | { |
219 | snprintf(buf, bufsize, "%s/%s", PIVOT_ROOT, dir); | 227 | snprintf(buf, bufsize, "%s/%s", PIVOT_ROOT, dir); |
220 | dir = buf; | 228 | dir = buf; |