summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSolomon Peachy <pizza@shaftnet.org>2020-10-11 08:26:53 -0400
committerSolomon Peachy <pizza@shaftnet.org>2020-10-11 17:47:34 -0400
commitdb6f21e2954db63cd04de73ed472c48f63b80a89 (patch)
tree252e2fccaef788141630ceeb67a03b69bd1654d1
parenta5add3982bff6907d30942f614d5a471f75c018b (diff)
downloadrockbox-db6f21e2954db63cd04de73ed472c48f63b80a89.tar.gz
rockbox-db6f21e2954db63cd04de73ed472c48f63b80a89.zip
hosted: sanitize handling of HOME_DIR
* HOME_DIR is now either "/" or special "<HOME>" * target-specific "home dir path" is defined solely by PIVOT_ROOT * PIVOT_ROOT path is now defined in toplevel config files * Make Samsung YP-R0/R1 and SONY_NWZ use PIVOT_ROOT too * Do not prepend PIVOT_ROOT path if the path already has it! * Do not play these games for __PCTOOL__ builds Change-Id: I3d51ad902a5f9cafe45ba15ba654f30f1ec6113a
-rw-r--r--apps/plugins/battery_bench.c2
-rw-r--r--apps/scrobbler.c15
-rw-r--r--bootloader/rocker_linux.c22
-rw-r--r--firmware/export/config/agptekrocker.h1
-rw-r--r--firmware/export/config/aigoerosq.h1
-rw-r--r--firmware/export/config/fiiom3k.h1
-rw-r--r--firmware/export/config/ibassodx50.h3
-rw-r--r--firmware/export/config/ibassodx90.h3
-rw-r--r--firmware/export/config/samsungypr0.h1
-rw-r--r--firmware/export/config/samsungypr1.h1
-rw-r--r--firmware/export/config/sonynwzlinux.h4
-rw-r--r--firmware/export/config/xduoox20.h1
-rw-r--r--firmware/export/config/xduoox3ii.h1
-rw-r--r--firmware/export/rbpaths.h27
-rw-r--r--firmware/target/hosted/filesystem-app.c35
-rw-r--r--firmware/target/hosted/rolo.c8
16 files changed, 58 insertions, 68 deletions
diff --git a/apps/plugins/battery_bench.c b/apps/plugins/battery_bench.c
index a3fd7267f0..deee2815bb 100644
--- a/apps/plugins/battery_bench.c
+++ b/apps/plugins/battery_bench.c
@@ -24,7 +24,7 @@
24#include "plugin.h" 24#include "plugin.h"
25#include "lang_enum.h" 25#include "lang_enum.h"
26 26
27#define BATTERY_LOG HOME_DIR"/battery_bench.txt" 27#define BATTERY_LOG HOME_DIR "/battery_bench.txt"
28#define BUF_SIZE 16000 28#define BUF_SIZE 16000
29 29
30#define EV_EXIT 1337 30#define EV_EXIT 1337
diff --git a/apps/scrobbler.c b/apps/scrobbler.c
index 7ad73248a2..657ce2e7ab 100644
--- a/apps/scrobbler.c
+++ b/apps/scrobbler.c
@@ -58,7 +58,7 @@ static int cache_pos = 0;
58static bool pending = false; 58static bool pending = false;
59#if CONFIG_RTC 59#if CONFIG_RTC
60static time_t timestamp; 60static time_t timestamp;
61#define BASE_FILENAME ".scrobbler.log" 61#define BASE_FILENAME HOME_DIR "/.scrobbler.log"
62#define HDR_STR_TIMELESS 62#define HDR_STR_TIMELESS
63#define get_timestamp() ((long)timestamp) 63#define get_timestamp() ((long)timestamp)
64#define record_timestamp() ((void)(timestamp = mktime(get_time()))) 64#define record_timestamp() ((void)(timestamp = mktime(get_time())))
@@ -72,21 +72,8 @@ static time_t timestamp;
72static void get_scrobbler_filename(char *path, size_t size) 72static void get_scrobbler_filename(char *path, size_t size)
73{ 73{
74 int used; 74 int used;
75/* Get location of USB mass storage area */
76#ifdef APPLICATION
77#if (CONFIG_PLATFORM & PLATFORM_MAEMO)
78 used = snprintf(path, size, "/home/user/MyDocs/%s", BASE_FILENAME);
79#elif (CONFIG_PLATFORM & PLATFORM_ANDROID)
80 used = snprintf(path, size, "/sdcard/%s", BASE_FILENAME);
81#elif defined (SAMSUNG_YPR0) || defined(DX50) || defined(DX90)
82 used = snprintf(path, size, "%s/%s", HOME_DIR, BASE_FILENAME);
83#else /* Everything else uses a pivot_root strategy.. */
84 used = snprintf(path, size, "/%s", BASE_FILENAME);
85#endif /* (CONFIG_PLATFORM & PLATFORM_MAEMO) */
86 75
87#else
88 used = snprintf(path, size, "/%s", BASE_FILENAME); 76 used = snprintf(path, size, "/%s", BASE_FILENAME);
89#endif
90 77
91 if (used >= (int)size) 78 if (used >= (int)size)
92 { 79 {
diff --git a/bootloader/rocker_linux.c b/bootloader/rocker_linux.c
index 28a1d78487..a6d69d0e9d 100644
--- a/bootloader/rocker_linux.c
+++ b/bootloader/rocker_linux.c
@@ -51,14 +51,12 @@
51#if defined(AGPTEK_ROCKER) 51#if defined(AGPTEK_ROCKER)
52#define ICON_WIDTH 70 52#define ICON_WIDTH 70
53#define ICON_HEIGHT 70 53#define ICON_HEIGHT 70
54#define RBFILE "rockbox.rocker"
55#define ICON_NAME bm_hibyicon 54#define ICON_NAME bm_hibyicon
56#define OF_NAME "HIBY PLAYER" 55#define OF_NAME "HIBY PLAYER"
57#include "bitmaps/hibyicon.h" 56#include "bitmaps/hibyicon.h"
58#elif defined(XDUOO_X3II) 57#elif defined(XDUOO_X3II)
59#define ICON_WIDTH 130 58#define ICON_WIDTH 130
60#define ICON_HEIGHT 130 59#define ICON_HEIGHT 130
61#define RBFILE "rockbox.x3ii"
62#define ICON_NAME bm_hibyicon 60#define ICON_NAME bm_hibyicon
63#define OF_NAME "HIBY PLAYER" 61#define OF_NAME "HIBY PLAYER"
64#define BUTTON_UP BUTTON_OPTION 62#define BUTTON_UP BUTTON_OPTION
@@ -68,7 +66,6 @@
68#elif defined(XDUOO_X20) 66#elif defined(XDUOO_X20)
69#define ICON_WIDTH 130 67#define ICON_WIDTH 130
70#define ICON_HEIGHT 130 68#define ICON_HEIGHT 130
71#define RBFILE "rockbox.x20"
72#define ICON_NAME bm_hibyicon 69#define ICON_NAME bm_hibyicon
73#define OF_NAME "HIBY PLAYER" 70#define OF_NAME "HIBY PLAYER"
74#define BUTTON_UP BUTTON_OPTION 71#define BUTTON_UP BUTTON_OPTION
@@ -78,7 +75,6 @@
78#elif defined(FIIO_M3K) 75#elif defined(FIIO_M3K)
79#define ICON_WIDTH 130 76#define ICON_WIDTH 130
80#define ICON_HEIGHT 130 77#define ICON_HEIGHT 130
81#define RBFILE "rockbox.fiiom3k"
82#define ICON_NAME bm_fiioicon 78#define ICON_NAME bm_fiioicon
83#define BUTTON_LEFT BUTTON_PREV 79#define BUTTON_LEFT BUTTON_PREV
84#define BUTTON_RIGHT BUTTON_NEXT 80#define BUTTON_RIGHT BUTTON_NEXT
@@ -88,7 +84,6 @@
88#elif defined(EROS_Q) 84#elif defined(EROS_Q)
89#define ICON_WIDTH 130 85#define ICON_WIDTH 130
90#define ICON_HEIGHT 130 86#define ICON_HEIGHT 130
91#define RBFILE "rockbox.erosq"
92#define ICON_NAME bm_hibyicon 87#define ICON_NAME bm_hibyicon
93#define OF_NAME "HIBY PLAYER" 88#define OF_NAME "HIBY PLAYER"
94#define BUTTON_UP BUTTON_SCROLL_BACK 89#define BUTTON_UP BUTTON_SCROLL_BACK
@@ -99,11 +94,12 @@
99#error "must define ICON_WIDTH/HEIGHT" 94#error "must define ICON_WIDTH/HEIGHT"
100#endif 95#endif
101 96
102#ifdef FIIO_M3K 97#define BASE_DIR PIVOT_ROOT
103#define BASE_DIR "/mnt" 98//#ifdef FIIO_M3K
104#else 99//#define BASE_DIR "/mnt"
105#define BASE_DIR "/mnt/sd_0" 100//#else
106#endif 101//#define BASE_DIR "/mnt/sd_0"
102//#endif
107 103
108/* images */ 104/* images */
109#include "bitmaps/rockboxicon.h" 105#include "bitmaps/rockboxicon.h"
@@ -631,9 +627,9 @@ int main(int argc, char **argv)
631 { 627 {
632 fflush(stdout); 628 fflush(stdout);
633 mount_storage(true); 629 mount_storage(true);
634 system("/bin/cp " BASE_DIR "/.rockbox/" RBFILE " /tmp"); 630 system("/bin/cp " BASE_DIR "/.rockbox/" BOOTFILE " /tmp");
635 system("/bin/chmod +x /tmp/" RBFILE); 631 system("/bin/chmod +x /tmp/" BOOTFILE);
636 execl("/tmp/" RBFILE, RBFILE, NULL); 632 execl("/tmp/" BOOTFILE, BOOTFILE, NULL);
637 printf("execvp failed: %s\n", strerror(errno)); 633 printf("execvp failed: %s\n", strerror(errno));
638 /* fallback to OF in case of failure */ 634 /* fallback to OF in case of failure */
639 error_screen("Cannot boot Rockbox"); 635 error_screen("Cannot boot Rockbox");
diff --git a/firmware/export/config/agptekrocker.h b/firmware/export/config/agptekrocker.h
index 230dc6cac4..f0e98d4db2 100644
--- a/firmware/export/config/agptekrocker.h
+++ b/firmware/export/config/agptekrocker.h
@@ -15,6 +15,7 @@
15 15
16#ifndef SIMULATOR 16#ifndef SIMULATOR
17#define CONFIG_PLATFORM (PLATFORM_HOSTED) 17#define CONFIG_PLATFORM (PLATFORM_HOSTED)
18#define PIVOT_ROOT "/mnt/sd_0"
18#endif 19#endif
19 20
20#define HIBY_LINUX 21#define HIBY_LINUX
diff --git a/firmware/export/config/aigoerosq.h b/firmware/export/config/aigoerosq.h
index 9207b5548f..6129557726 100644
--- a/firmware/export/config/aigoerosq.h
+++ b/firmware/export/config/aigoerosq.h
@@ -15,6 +15,7 @@
15 15
16#ifndef SIMULATOR 16#ifndef SIMULATOR
17#define CONFIG_PLATFORM (PLATFORM_HOSTED) 17#define CONFIG_PLATFORM (PLATFORM_HOSTED)
18#define PIVOT_ROOT "/mnt/sd_0"
18#endif 19#endif
19 20
20#define HIBY_LINUX 21#define HIBY_LINUX
diff --git a/firmware/export/config/fiiom3k.h b/firmware/export/config/fiiom3k.h
index 88652b633f..933e85dab9 100644
--- a/firmware/export/config/fiiom3k.h
+++ b/firmware/export/config/fiiom3k.h
@@ -15,6 +15,7 @@
15 15
16#ifndef SIMULATOR 16#ifndef SIMULATOR
17#define CONFIG_PLATFORM (PLATFORM_HOSTED) 17#define CONFIG_PLATFORM (PLATFORM_HOSTED)
18#define PIVOT_ROOT "/mnt"
18#endif 19#endif
19 20
20#define HAVE_FPU 21#define HAVE_FPU
diff --git a/firmware/export/config/ibassodx50.h b/firmware/export/config/ibassodx50.h
index 4107fd496f..22215ef9e4 100644
--- a/firmware/export/config/ibassodx50.h
+++ b/firmware/export/config/ibassodx50.h
@@ -24,7 +24,10 @@
24/* This config file is for Rockbox as an application on Android without JVM. */ 24/* This config file is for Rockbox as an application on Android without JVM. */
25 25
26/* We don't run on hardware directly */ 26/* We don't run on hardware directly */
27#ifndef SIMULATOR
27#define CONFIG_PLATFORM PLATFORM_HOSTED 28#define CONFIG_PLATFORM PLATFORM_HOSTED
29#define PIVOT_ROOT "/mnt/sdcard"
30#endif
28#define HAVE_FPU 31#define HAVE_FPU
29 32
30/* For Rolo and boot loader */ 33/* For Rolo and boot loader */
diff --git a/firmware/export/config/ibassodx90.h b/firmware/export/config/ibassodx90.h
index ae5a446aa3..b0cff1a8d0 100644
--- a/firmware/export/config/ibassodx90.h
+++ b/firmware/export/config/ibassodx90.h
@@ -24,7 +24,10 @@
24/* This config file is for Rockbox as an application on Android without JVM. */ 24/* This config file is for Rockbox as an application on Android without JVM. */
25 25
26/* We don't run on hardware directly */ 26/* We don't run on hardware directly */
27#ifndef SIMULATOR
27#define CONFIG_PLATFORM PLATFORM_HOSTED 28#define CONFIG_PLATFORM PLATFORM_HOSTED
29#define PIVOT_ROOT "/mnt/sdcard"
30#endif
28#define HAVE_FPU 31#define HAVE_FPU
29 32
30/* For Rolo and boot loader */ 33/* For Rolo and boot loader */
diff --git a/firmware/export/config/samsungypr0.h b/firmware/export/config/samsungypr0.h
index 414ba39517..655ed811b7 100644
--- a/firmware/export/config/samsungypr0.h
+++ b/firmware/export/config/samsungypr0.h
@@ -7,6 +7,7 @@
7/* YP-R0 need it too of course */ 7/* YP-R0 need it too of course */
8#ifndef SIMULATOR 8#ifndef SIMULATOR
9#define CONFIG_PLATFORM (PLATFORM_HOSTED) 9#define CONFIG_PLATFORM (PLATFORM_HOSTED)
10#define PIVOT_ROOT "/mnt/media0"
10#endif 11#endif
11 12
12/* For Rolo and boot loader */ 13/* For Rolo and boot loader */
diff --git a/firmware/export/config/samsungypr1.h b/firmware/export/config/samsungypr1.h
index 4d5c4a88f9..6f9904614c 100644
--- a/firmware/export/config/samsungypr1.h
+++ b/firmware/export/config/samsungypr1.h
@@ -7,6 +7,7 @@
7/* YP-R1 need it too of course */ 7/* YP-R1 need it too of course */
8#ifndef SIMULATOR 8#ifndef SIMULATOR
9#define CONFIG_PLATFORM (PLATFORM_HOSTED) 9#define CONFIG_PLATFORM (PLATFORM_HOSTED)
10#define PIVOT_ROOT "/mnt/media0"
10#endif 11#endif
11 12
12/* For Rolo and boot loader */ 13/* For Rolo and boot loader */
diff --git a/firmware/export/config/sonynwzlinux.h b/firmware/export/config/sonynwzlinux.h
index 66f18724db..074ad1c417 100644
--- a/firmware/export/config/sonynwzlinux.h
+++ b/firmware/export/config/sonynwzlinux.h
@@ -4,11 +4,9 @@
4 4
5#ifndef SIMULATOR 5#ifndef SIMULATOR
6#define CONFIG_PLATFORM (PLATFORM_HOSTED) 6#define CONFIG_PLATFORM (PLATFORM_HOSTED)
7#define PIVOT_ROOT "/contents"
7#endif 8#endif
8 9
9
10
11
12/* define this if you have a colour LCD */ 10/* define this if you have a colour LCD */
13#define HAVE_LCD_COLOR 11#define HAVE_LCD_COLOR
14 12
diff --git a/firmware/export/config/xduoox20.h b/firmware/export/config/xduoox20.h
index 70e6131cb7..e12346e1bc 100644
--- a/firmware/export/config/xduoox20.h
+++ b/firmware/export/config/xduoox20.h
@@ -15,6 +15,7 @@
15 15
16#ifndef SIMULATOR 16#ifndef SIMULATOR
17#define CONFIG_PLATFORM (PLATFORM_HOSTED) 17#define CONFIG_PLATFORM (PLATFORM_HOSTED)
18#define PIVOT_ROOT "/mnt/sd_0"
18#endif 19#endif
19 20
20#define HIBY_LINUX 21#define HIBY_LINUX
diff --git a/firmware/export/config/xduoox3ii.h b/firmware/export/config/xduoox3ii.h
index d19165114a..0b886e3af9 100644
--- a/firmware/export/config/xduoox3ii.h
+++ b/firmware/export/config/xduoox3ii.h
@@ -15,6 +15,7 @@
15 15
16#ifndef SIMULATOR 16#ifndef SIMULATOR
17#define CONFIG_PLATFORM (PLATFORM_HOSTED) 17#define CONFIG_PLATFORM (PLATFORM_HOSTED)
18#define PIVOT_ROOT "/mnt/sd_0"
18#endif 19#endif
19 20
20#define HIBY_LINUX 21#define HIBY_LINUX
diff --git a/firmware/export/rbpaths.h b/firmware/export/rbpaths.h
index 215b4c0c4b..da5a2fb71c 100644
--- a/firmware/export/rbpaths.h
+++ b/firmware/export/rbpaths.h
@@ -40,24 +40,12 @@
40#define ROCKBOX_DIR_LEN (sizeof(ROCKBOX_DIR)-1) 40#define ROCKBOX_DIR_LEN (sizeof(ROCKBOX_DIR)-1)
41#endif /* def __PCTOOL__ */ 41#endif /* def __PCTOOL__ */
42 42
43/* NOTE: target-specific hosted HOME_DIR resides in filesystem-app.c */
43#if !defined(APPLICATION) || defined(SAMSUNG_YPR0) || defined(SAMSUNG_YPR1) || \ 44#if !defined(APPLICATION) || defined(SAMSUNG_YPR0) || defined(SAMSUNG_YPR1) || \
44 defined(DX50) || defined(DX90) || defined(SONY_NWZ_LINUX) || \ 45 defined(DX50) || defined(DX90) || defined(SONY_NWZ_LINUX) || \
45 defined(HIBY_LINUX) || defined(FIIO_M3K) 46 defined(HIBY_LINUX) || defined(FIIO_M3K)
46 47
47#if defined(SAMSUNG_YPR0) || defined(SAMSUNG_YPR1)
48#define HOME_DIR "/mnt/media0"
49#elif defined(SONY_NWZ_LINUX)
50#define HOME_DIR "/contents"
51#elif defined(DX50) || defined(DX90)
52/* Where to put save files like recordings, playlists, screen dumps ...*/
53#define HOME_DIR "/mnt/sdcard"
54#elif defined(HIBY_LINUX)
55#define HOME_DIR "/mnt/sd_0"
56#elif defined(FIIO_M3K)
57#define HOME_DIR "/mnt"
58#else
59#define HOME_DIR "/" 48#define HOME_DIR "/"
60#endif
61 49
62/* make sure both are the same for native builds */ 50/* make sure both are the same for native builds */
63#undef ROCKBOX_LIBRARY_PATH 51#undef ROCKBOX_LIBRARY_PATH
@@ -69,6 +57,7 @@
69#else /* APPLICATION */ 57#else /* APPLICATION */
70 58
71#define HOME_DIR "<HOME>" /* replaced at runtime */ 59#define HOME_DIR "<HOME>" /* replaced at runtime */
60#define HAVE_SPECIAL_DIRS
72 61
73#define PLUGIN_DIR ROCKBOX_LIBRARY_PATH "/rockbox/rocks" 62#define PLUGIN_DIR ROCKBOX_LIBRARY_PATH "/rockbox/rocks"
74#if (CONFIG_PLATFORM & PLATFORM_ANDROID) 63#if (CONFIG_PLATFORM & PLATFORM_ANDROID)
@@ -79,10 +68,8 @@
79 68
80#endif /* !APPLICATION || SAMSUNG_YPR0 */ 69#endif /* !APPLICATION || SAMSUNG_YPR0 */
81 70
82#define HOME_DIR_LEN (sizeof(HOME_DIR)-1) 71#define REC_BASE_DIR HOME_DIR "/Recordings"
83 72#define PLAYLIST_CATALOG_DEFAULT_DIR HOME_DIR "/Playlists"
84#define REC_BASE_DIR "/Recordings"
85#define PLAYLIST_CATALOG_DEFAULT_DIR "/Playlists"
86 73
87#define LANG_DIR ROCKBOX_DIR "/langs" 74#define LANG_DIR ROCKBOX_DIR "/langs"
88 75
@@ -91,8 +78,10 @@
91#define PLUGIN_DEMOS_DIR PLUGIN_DIR "/demos" 78#define PLUGIN_DEMOS_DIR PLUGIN_DIR "/demos"
92#define VIEWERS_DIR PLUGIN_DIR "/viewers" 79#define VIEWERS_DIR PLUGIN_DIR "/viewers"
93 80
94#if defined(APPLICATION) && !(defined(SAMSUNG_YPR0) || defined(SAMSUNG_YPR1) || \ 81#if defined(APPLICATION) && \
95 defined(DX50) || defined(DX90) || defined(SONY_NWZ_LINUX) || defined(HIBY_LINUX)) 82 !(defined(SAMSUNG_YPR0) || defined(SAMSUNG_YPR1) || \
83 defined(DX50) || defined(DX90) || defined(SONY_NWZ_LINUX) || defined(HIBY_LINUX) || defined(FIIO_M3K))
84
96#define PLUGIN_DATA_DIR ROCKBOX_DIR "/rocks.data" 85#define PLUGIN_DATA_DIR ROCKBOX_DIR "/rocks.data"
97#define PLUGIN_GAMES_DATA_DIR PLUGIN_DATA_DIR 86#define PLUGIN_GAMES_DATA_DIR PLUGIN_DATA_DIR
98#define PLUGIN_APPS_DATA_DIR PLUGIN_DATA_DIR 87#define PLUGIN_APPS_DATA_DIR PLUGIN_DATA_DIR
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)
49static const char rbhome[] = "/sdcard"; 47static 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 */
55static const char rbhome[] = HOME_DIR; 53static 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}
diff --git a/firmware/target/hosted/rolo.c b/firmware/target/hosted/rolo.c
index 432d69c86e..2aa3071c9a 100644
--- a/firmware/target/hosted/rolo.c
+++ b/firmware/target/hosted/rolo.c
@@ -91,8 +91,14 @@ int rolo_load(const char* filename)
91 lcd_remote_update(); 91 lcd_remote_update();
92#endif 92#endif
93 93
94#ifdef PIVOT_ROOT
95#define EXECDIR PIVOT_ROOT
96#else
97#define EXECDIR ROOT_DIR
98#endif
99
94 char buf[256]; 100 char buf[256];
95 snprintf(buf, sizeof(buf), "%s/%s", HOME_DIR, filename); 101 snprintf(buf, sizeof(buf), "%s/%s", EXECDIR, filename);
96 execl(buf, BOOTFILE, NULL); 102 execl(buf, BOOTFILE, NULL);
97 103
98 rolo_error("Failed to launch!", strerror(errno)); 104 rolo_error("Failed to launch!", strerror(errno));