Skip to content

Commit

Permalink
Added folder creation if needed
Browse files Browse the repository at this point in the history
  • Loading branch information
KiritoDv committed Jan 16, 2025
1 parent b96910b commit c11ad9e
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/archive/ZWrapper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,14 @@ ZWrapper::ZWrapper(const std::string& path) {
mPath = path;
}

bool CreateFolderIfNeeded(const std::string& filePath) {
fs::path parentDir = fs::path(filePath).parent_path();
return !parentDir.empty() && parentDir != parentDir.root_path()
&& (fs::exists(parentDir) || fs::create_directories(parentDir));
}

int32_t ZWrapper::CreateArchive() {
CreateFolderIfNeeded(mPath);
SPDLOG_INFO("Loaded ZIP (O2R) archive: {}", mPath.c_str());
return 0;
}
Expand Down

0 comments on commit c11ad9e

Please sign in to comment.