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.
pull/7924/head
Kevin Bracey 2018-09-04 11:55:25 +03:00
parent fd4b3879be
commit c0dbc49aa0
1 changed files with 6 additions and 4 deletions

View File

@ -80,15 +80,17 @@ MBED_WEAK FileSystem *FileSystem::get_default_instance()
{
#if COMPONENT_SPIF || COMPONENT_DATAFLASH
static LittleFileSystem default_fs("default", BlockDevice::get_default_instance());
static LittleFileSystem flash("flash", BlockDevice::get_default_instance());
flash.set_as_default();
return &default_fs;
return &flash;
#elif COMPONENT_SD
static FATFileSystem default_fs("default", BlockDevice::get_default_instance());
static FATFileSystem sdcard("sd", BlockDevice::get_default_instance());
sdcard.set_as_default();
return &default_fs;
return &sdcard;
#else