소스 검색

common/file_util: Succeed on CreateDir when the directory exists

ReinUsesLisp 5 년 전
부모
커밋
52f13f2339
1개의 변경된 파일5개의 추가작업 그리고 0개의 파일을 삭제
  1. 5 0
      src/common/file_util.cpp

+ 5 - 0
src/common/file_util.cpp

@@ -98,6 +98,11 @@ 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);