File tree 2 files changed +23
-21
lines changed
2 files changed +23
-21
lines changed Original file line number Diff line number Diff line change @@ -36,28 +36,30 @@ UFile Folder::createFile(String fileName, FileMode fmode) {
36
36
}
37
37
38
38
bool Folder::remove () {
39
+ // Check if the directory exists
40
+ if (!this ->exists ()){
41
+ return false ;
42
+ }
43
+
39
44
// Remove all files in the directory
40
- if (this ->exists ()){
41
- std::vector<UFile> files = this ->getFiles ();
42
- for (UFile file : files) {
43
- file.remove ();
44
- }
45
+ std::vector<UFile> files = this ->getFiles ();
46
+ for (UFile file : files) {
47
+ file.remove ();
48
+ }
45
49
46
- // Remove all subfolders in the directory
47
- std::vector<Folder> folders = this ->getFolders ();
48
- for (Folder directory : folders) {
49
- directory.remove ();
50
- }
50
+ // Remove all subfolders in the directory
51
+ std::vector<Folder> folders = this ->getFolders ();
52
+ for (Folder directory : folders) {
53
+ directory.remove ();
54
+ }
51
55
52
- // Remove the current directory
53
- if (::remove (this ->path .c_str ()) == 0 ) {
54
- return true ;
55
- } else {
56
- // Error occurred while removing the directory
57
- return false ;
58
- }
56
+ // Remove the current directory
57
+ if (::remove (this ->path .c_str ()) == 0 ) {
58
+ return true ;
59
+ } else {
60
+ // Error occurred while removing the directory
61
+ return false ;
59
62
}
60
-
61
63
}
62
64
63
65
bool Folder::rename (const char * newDirname) {
Original file line number Diff line number Diff line change @@ -26,15 +26,15 @@ bool InternalStorage::begin(FileSystems fileSystemType){
26
26
}
27
27
28
28
bool InternalStorage::partition (std::vector<Partition> partitions){
29
- Partitioning::partitionDrive (QSPIFBlockDeviceType::get_default_instance (), partitions);
29
+ return Partitioning::partitionDrive (QSPIFBlockDeviceType::get_default_instance (), partitions);
30
30
}
31
31
32
32
bool InternalStorage::partition (){
33
- Partitioning::partitionDrive (QSPIFBlockDeviceType::get_default_instance (), {{QSPI_STORAGE_SIZE, FS_LITTLEFS}});
33
+ return Partitioning::partitionDrive (QSPIFBlockDeviceType::get_default_instance (), {{QSPI_STORAGE_SIZE, FS_LITTLEFS}});
34
34
}
35
35
36
36
bool InternalStorage::restoreDefaultPartitions (){
37
- Partitioning::partitionDrive (QSPIFBlockDeviceType::get_default_instance (), {
37
+ return Partitioning::partitionDrive (QSPIFBlockDeviceType::get_default_instance (), {
38
38
{1024 , FS_FAT}, // 1 MB for certificates
39
39
{5120 , FS_FAT}, // 5 MB for OTA firmware updates
40
40
{8192 , FS_LITTLEFS} // 8 MB for user data
You can’t perform that action at this time.
0 commit comments