diff options
-rw-r--r-- | firmware/target/hosted/filesystem-app.c | 24 |
1 files changed, 14 insertions, 10 deletions
diff --git a/firmware/target/hosted/filesystem-app.c b/firmware/target/hosted/filesystem-app.c index 93fadc6d6e..d73704737a 100644 --- a/firmware/target/hosted/filesystem-app.c +++ b/firmware/target/hosted/filesystem-app.c | |||
@@ -69,18 +69,22 @@ static const char *handle_special_links(const char* link, unsigned flags, | |||
69 | { | 69 | { |
70 | (void) flags; | 70 | (void) flags; |
71 | char vol_string[VOL_MAX_LEN + 1]; | 71 | char vol_string[VOL_MAX_LEN + 1]; |
72 | int len = get_volume_name(-1, vol_string); | 72 | int len; |
73 | 73 | ||
74 | /* link might be passed with or without HOME_DIR expanded. To handle | 74 | for (int i = 1; i < NUM_VOLUMES; i++) |
75 | * both perform substring matching (VOL_NAMES is unique enough) */ | ||
76 | const char *begin = strstr(link, vol_string); | ||
77 | if (begin) | ||
78 | { | 75 | { |
79 | /* begin now points to the start of vol_string within link, | 76 | len = get_volume_name(i, vol_string); |
80 | * we want to copy the remainder of the paths, prefixed by | 77 | /* link might be passed with or without HOME_DIR expanded. To handle |
81 | * the actual mount point (the remainder might be "") */ | 78 | * both perform substring matching (VOL_NAMES is unique enough) */ |
82 | snprintf(buf, bufsize, MULTIDRIVE_DIR"%s", begin + len); | 79 | const char *begin = strstr(link, vol_string); |
83 | return buf; | 80 | if (begin) |
81 | { | ||
82 | /* begin now points to the start of vol_string within link, | ||
83 | * we want to copy the remainder of the paths, prefixed by | ||
84 | * the actual mount point (the remainder might be "") */ | ||
85 | snprintf(buf, bufsize, MULTIDRIVE_DIR"%s", begin + len); | ||
86 | return buf; | ||
87 | } | ||
84 | } | 88 | } |
85 | 89 | ||
86 | return link; | 90 | return link; |