diff options
author | JackLivio <jack@livio.io> | 2018-08-30 16:43:19 -0400 |
---|---|---|
committer | JackLivio <jack@livio.io> | 2018-08-30 16:43:19 -0400 |
commit | 7dd8d7a6435bbb3bcc301e814f50e6b02bde4bd4 (patch) | |
tree | 98553f8ae0fc03d6d7fd7f06b8407801868fd450 | |
parent | f2af95a3474ab98a1fb6897aee019a45bd12ace5 (diff) | |
download | sdl_core-7dd8d7a6435bbb3bcc301e814f50e6b02bde4bd4.tar.gz |
Update based on comments
-rw-r--r-- | src/components/utils/src/file_system.cc | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/components/utils/src/file_system.cc b/src/components/utils/src/file_system.cc index 8c09e7cfc7..f98aeda056 100644 --- a/src/components/utils/src/file_system.cc +++ b/src/components/utils/src/file_system.cc @@ -213,7 +213,9 @@ bool file_system::IsFileNameValid(const std::string& file_name) { // Does not remove if file is write-protected bool file_system::DeleteFile(const std::string& name) { if (FileExists(name) && IsAccessible(name, W_OK)) { - return fs::remove(name.c_str()); + error_code ec; + bool success = fs::remove(name.c_str(), ec); + return success && !ec; } return false; } @@ -250,7 +252,7 @@ bool file_system::RemoveDirectory(const std::string& directory_name, bool success; // If recursive, just force full remove if (is_recursively) { - success = (fs::remove_all(directory_name, ec) == 0); + success = (fs::remove_all(directory_name, ec) != 0); } else { // Otherwise try to remove success = fs::remove(directory_name, ec); |