mirror of
https://git.mirrors.martin98.com/https://github.com/luc-github/ESP3D.git
synced 2025-08-05 09:20:43 +08:00
prepare API for shorname
Fix filename for esp8266
This commit is contained in:
parent
bead8ba2d8
commit
bd026eabe9
@ -41,6 +41,7 @@ public:
|
||||
operator bool() const;
|
||||
bool isDirectory();
|
||||
const char* name() const;
|
||||
const char* shortname() const;
|
||||
const char* filename() const;
|
||||
void close();
|
||||
bool isOpen();
|
||||
|
@ -336,6 +336,12 @@ ESP_SDFile ESP_SDFile::openNextFile()
|
||||
return ESP_SDFile();
|
||||
}
|
||||
|
||||
//TODO need to find reliable way
|
||||
const char* ESP_SDFile::shortname() const
|
||||
{
|
||||
return _name.c_str();
|
||||
}
|
||||
|
||||
const char * ESP_SD::FilesystemName()
|
||||
{
|
||||
return "SD native";
|
||||
|
@ -244,9 +244,9 @@ ESP_SDFile::ESP_SDFile(void* handle, bool isdir, bool iswritemode, const char *
|
||||
//filename
|
||||
char tmp[255];
|
||||
tSDFile_handle[i].getName(tmp,254);
|
||||
_filename = tmp;
|
||||
_filename = path;
|
||||
//name
|
||||
_name = _filename;
|
||||
_name = tmp;
|
||||
if (_name.endsWith("/")) {
|
||||
_name.remove( _name.length() - 1,1);
|
||||
_isfakedir = true;
|
||||
@ -272,6 +272,13 @@ ESP_SDFile::ESP_SDFile(void* handle, bool isdir, bool iswritemode, const char *
|
||||
}
|
||||
}
|
||||
|
||||
const char* ESP_SDFile::shortname() const
|
||||
{
|
||||
//static char shorname[13];
|
||||
//entry.getSFN(tmps);
|
||||
return _filename.c_str();
|
||||
}
|
||||
|
||||
void ESP_SDFile::close()
|
||||
{
|
||||
if (_index != -1) {
|
||||
@ -303,12 +310,13 @@ ESP_SDFile ESP_SDFile::openNextFile()
|
||||
}
|
||||
sdfat::File tmp = tSDFile_handle[_index].openNextFile();
|
||||
if (tmp){
|
||||
#if defined(ESP_DEBUG_FEATURE)
|
||||
char tmps[255];
|
||||
tmp.getName(tmps,254);
|
||||
log_esp3d("tmp name :%s %s", tmps, (tmp.isDir())?"isDir":"isFile");
|
||||
#endif //ESP_DEBUG_FEATURE
|
||||
ESP_SDFile esptmp(&tmp, tmp.isDir());
|
||||
String s = _filename ;
|
||||
if (s!="/")s+="/";
|
||||
s += tmps;
|
||||
ESP_SDFile esptmp(&tmp, tmp.isDir(),false, s.c_str());
|
||||
esptmp.close();
|
||||
return esptmp;
|
||||
}
|
||||
|
@ -330,5 +330,11 @@ const char * ESP_SD::FilesystemName()
|
||||
return "SDIO";
|
||||
}
|
||||
|
||||
//TODO need to find reliable way
|
||||
const char* ESP_SDFile::shortname() const
|
||||
{
|
||||
return _name.c_str();
|
||||
}
|
||||
|
||||
#endif //SD_DEVICE == ESP_SDIO
|
||||
#endif //ARCH_ESP32 && SD_DEVICE
|
||||
|
Loading…
x
Reference in New Issue
Block a user