Skip to content

Commit d44f999

Browse files
authored
Merge pull request #6156 from geky/fix-path-leading-slash
retarget: Fix path behaviour without leading slash
2 parents d9cb00d + 72b0a07 commit d44f999

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

platform/FilePath.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,10 @@
1818
namespace mbed {
1919

2020
FilePath::FilePath(const char* file_path) : file_name(NULL), fb(NULL) {
21-
if ((file_path[0] != '/') || (file_path[1] == 0)) return;
21+
// skip slashes
22+
file_path += strspn(file_path, "/");
2223

23-
const char* file_system = &file_path[1];
24+
const char* file_system = file_path;
2425
file_name = file_system;
2526
int len = 0;
2627
while (true) {
@@ -36,6 +37,7 @@ FilePath::FilePath(const char* file_path) : file_name(NULL), fb(NULL) {
3637
file_name++;
3738
}
3839

40+
MBED_ASSERT(len != 0);
3941
fb = FileBase::lookup(file_system, len);
4042
}
4143

0 commit comments

Comments
 (0)