diff options
| author | Morph <39850852+Morph1984@users.noreply.github.com> | 2020-12-11 20:22:01 -0500 |
|---|---|---|
| committer | Morph <39850852+Morph1984@users.noreply.github.com> | 2020-12-11 20:24:22 -0500 |
| commit | 07b5c70975de54f1caaf0c0a10c27847a3c2b4a3 (patch) | |
| tree | a3a2c67a83080b4693096474852d8b72a1a95c4c /src/common/file_util.cpp | |
| parent | 9e47a3f7cd386ad67d7f5c2afa77e41a8e93cae9 (diff) | |
Revert "Merge pull request #5174 from ReinUsesLisp/fs-fix"
This reverts commit 1f5f5d8d3cd5b399260a8bb8f30dda5ac30aab3d, reversing
changes made to 714b347f9609bcf36cefe4885927e9738219873c.
Diffstat (limited to 'src/common/file_util.cpp')
| -rw-r--r-- | src/common/file_util.cpp | 30 |
1 files changed, 2 insertions, 28 deletions
diff --git a/src/common/file_util.cpp b/src/common/file_util.cpp index 7752c04213..d5f6ea2ee8 100644 --- a/src/common/file_util.cpp +++ b/src/common/file_util.cpp @@ -98,11 +98,6 @@ bool Delete(const fs::path& path) { bool CreateDir(const fs::path& path) { LOG_TRACE(Common_Filesystem, "directory {}", path.string()); - if (Exists(path)) { - LOG_DEBUG(Common_Filesystem, "path exists {}", path.string()); - return true; - } - std::error_code ec; const bool success = fs::create_directory(path, ec); @@ -114,41 +109,20 @@ bool CreateDir(const fs::path& path) { return true; } -bool CreateDirs(const fs::path& path) { +bool CreateFullPath(const fs::path& path) { LOG_TRACE(Common_Filesystem, "path {}", path.string()); - if (Exists(path)) { - LOG_DEBUG(Common_Filesystem, "path exists {}", path.string()); - return true; - } - std::error_code ec; const bool success = fs::create_directories(path, ec); if (!success) { - LOG_ERROR(Common_Filesystem, "Unable to create directories: {}", ec.message()); + LOG_ERROR(Common_Filesystem, "Unable to create full path: {}", ec.message()); return false; } return true; } -bool CreateFullPath(const fs::path& path) { - LOG_TRACE(Common_Filesystem, "path {}", path); - - // Removes trailing slashes and turns any '\' into '/' - const auto new_path = SanitizePath(path.string(), DirectorySeparator::ForwardSlash); - - if (new_path.rfind('.') == std::string::npos) { - // The path is a directory - return CreateDirs(new_path); - } else { - // The path is a file - // Creates directory preceding the last '/' - return CreateDirs(new_path.substr(0, new_path.rfind('/'))); - } -} - bool Rename(const fs::path& src, const fs::path& dst) { LOG_TRACE(Common_Filesystem, "{} --> {}", src.string(), dst.string()); |
