Skip to content

Commit 0331227

Browse files
committed
Simplify code
1 parent 852ef17 commit 0331227

File tree

1 file changed

+5
-12
lines changed

1 file changed

+5
-12
lines changed

src/UFile.cpp

Lines changed: 5 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -161,18 +161,11 @@ size_t UFile::write(const uint8_t* buffer, size_t size) {
161161
}
162162

163163
bool UFile::remove() {
164-
// Remove the file;
165-
if(this->exists() && !path.empty()){
166-
int result = ::remove(path.c_str());
167-
if (result == 0) {
168-
return true;
169-
} else {
170-
// Error occurred while removing the file
171-
return false;
172-
}
173-
} else {
174-
return false; // Handle the case when the path is not valid
175-
}
164+
if (!this->exists() || path.empty()) {
165+
return false; // Handle the case when the path is not valid
166+
}
167+
168+
return ::remove(path.c_str()) == 0;
176169
}
177170

178171
bool UFile::rename(const char* newFilename) {

0 commit comments

Comments
 (0)