Skip to content

Commit be4f8b0

Browse files
committed
Add missing return statements
1 parent dd83662 commit be4f8b0

File tree

2 files changed

+23
-21
lines changed

2 files changed

+23
-21
lines changed

src/Folder.cpp

Lines changed: 20 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -36,28 +36,30 @@ UFile Folder::createFile(String fileName, FileMode fmode) {
3636
}
3737

3838
bool Folder::remove() {
39+
// Check if the directory exists
40+
if(!this->exists()){
41+
return false;
42+
}
43+
3944
// 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+
}
4549

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+
}
5155

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;
5962
}
60-
6163
}
6264

6365
bool Folder::rename(const char* newDirname) {

src/InternalStorage.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,15 +26,15 @@ bool InternalStorage::begin(FileSystems fileSystemType){
2626
}
2727

2828
bool InternalStorage::partition(std::vector<Partition> partitions){
29-
Partitioning::partitionDrive(QSPIFBlockDeviceType::get_default_instance(), partitions);
29+
return Partitioning::partitionDrive(QSPIFBlockDeviceType::get_default_instance(), partitions);
3030
}
3131

3232
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}});
3434
}
3535

3636
bool InternalStorage::restoreDefaultPartitions(){
37-
Partitioning::partitionDrive(QSPIFBlockDeviceType::get_default_instance(), {
37+
return Partitioning::partitionDrive(QSPIFBlockDeviceType::get_default_instance(), {
3838
{1024, FS_FAT}, // 1 MB for certificates
3939
{5120, FS_FAT}, // 5 MB for OTA firmware updates
4040
{8192, FS_LITTLEFS} // 8 MB for user data

0 commit comments

Comments
 (0)