fix nffs_inode_read_filename does not update out_full_len
This commit is contained in:
1 parent
f6a66d444a
commit
48718392c3
6 files changed
+59
-12
No files matched your search
@@ -199,3 +199,39 @@ bool ApacheNffs::testFolder(const char* path)
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
/*------------------------------------------------------------------*/
|
||||
/* Debug
|
||||
*------------------------------------------------------------------*/
|
||||
void dbgPrintDir(const char* cwd)
|
||||
{
|
||||
// Open the input folder
|
||||
NffsDir dir(cwd);
|
||||
|
||||
// File Entry Information which hold file attribute and name
|
||||
NffsDirEntry dirEntry;
|
||||
|
||||
Serial.println(cwd);
|
||||
|
||||
// Loop through the directory
|
||||
while( dir.read(&dirEntry) )
|
||||
{
|
||||
Serial.print("|_ ");
|
||||
|
||||
char eName[64];
|
||||
dirEntry.getName(eName, sizeof(eName));
|
||||
|
||||
if ( dirEntry.isDirectory() )
|
||||
{
|
||||
Serial.print( eName );
|
||||
Serial.println("/");
|
||||
}else
|
||||
{
|
||||
NffsFile file(cwd, dirEntry, FS_ACCESS_READ);
|
||||
Serial.printf("%-30s %d Bytes\n", eName, file.size() );
|
||||
file.close();
|
||||
}
|
||||
}
|
||||
|
||||
dir.close();
|
||||
}
|
||||
@@ -53,6 +53,12 @@ NffsFile::NffsFile(const char* path, uint8_t flags)
|
||||
open(path, flags);
|
||||
}
|
||||
|
||||
NffsFile::NffsFile(const char* parent_dir, NffsDirEntry& dirent, uint8_t flags)
|
||||
{
|
||||
_init();
|
||||
open(parent_dir, dirent, flags);
|
||||
}
|
||||
|
||||
NffsFile::~NffsFile()
|
||||
{
|
||||
if (_file) close();
|
||||
@@ -79,7 +85,7 @@ bool NffsFile::open(const char* parent_dir, NffsDirEntry& dirent, uint8_t flags)
|
||||
|
||||
if ( dirent.getName(name+len, NFFS_FILENAME_MAX_LEN+1-len) > 0 )
|
||||
{
|
||||
result = open(name);
|
||||
result = open(name, flags);
|
||||
}
|
||||
|
||||
rtos_free(name);
|
||||
|
||||
@@ -49,9 +49,9 @@ public:
|
||||
int errnum;
|
||||
|
||||
NffsFile(void);
|
||||
virtual ~NffsFile();
|
||||
|
||||
NffsFile(const char* path, uint8_t flags = FS_ACCESS_READ);
|
||||
NffsFile(const char* parent_dir, NffsDirEntry& dirent, uint8_t flags = FS_ACCESS_READ);
|
||||
virtual ~NffsFile();
|
||||
|
||||
bool open(const char* path, uint8_t flags = FS_ACCESS_READ);
|
||||
bool open(const char* parent_dir, NffsDirEntry& dirent, uint8_t flags = FS_ACCESS_READ);
|
||||
|
||||
@@ -775,6 +775,9 @@ nffs_inode_read_filename(struct nffs_inode_entry *inode_entry, size_t max_len,
|
||||
|
||||
out_name[read_len] = '\0';
|
||||
|
||||
// Adafruit fix
|
||||
*out_full_len = (uint8_t) read_len;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user