Skip to content

Commit c0dbc49

Browse files
committed
Make "/default" an alias - add real names too
Make the built-in FileSystem::get_default_instance() implementation instantiate storage as "flash" or "sd", with "default" as an alias. This will aid interworking between simple and advanced filesystem code on various platforms. The expectation is that the names "sd" or "flash" will be always available if the device is available and configured, regardless of what "default" represents.
1 parent fd4b387 commit c0dbc49

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

features/storage/system_storage/SystemStorage.cpp

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -80,15 +80,17 @@ MBED_WEAK FileSystem *FileSystem::get_default_instance()
8080
{
8181
#if COMPONENT_SPIF || COMPONENT_DATAFLASH
8282

83-
static LittleFileSystem default_fs("default", BlockDevice::get_default_instance());
83+
static LittleFileSystem flash("flash", BlockDevice::get_default_instance());
84+
flash.set_as_default();
8485

85-
return &default_fs;
86+
return &flash;
8687

8788
#elif COMPONENT_SD
8889

89-
static FATFileSystem default_fs("default", BlockDevice::get_default_instance());
90+
static FATFileSystem sdcard("sd", BlockDevice::get_default_instance());
91+
sdcard.set_as_default();
9092

91-
return &default_fs;
93+
return &sdcard;
9294

9395
#else
9496

0 commit comments

Comments
 (0)