Skip to content

Commit

Permalink
Check before creating directory & remove redundant create
Browse files Browse the repository at this point in the history
  • Loading branch information
igvk committed Sep 9, 2024
1 parent 618ea6d commit d3856f3
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 0 additions & 2 deletions src_cpp/src_pdb/commands/command_pdb_generate.h
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,6 @@ namespace FakePDB::Commands {
PDB::PdbCreator creator;
creator.Initialize(ida_db, path_exe, with_labels);

std::filesystem::create_directories(path_out.parent_path());

creator.Commit(path_out);

return 0;
Expand Down
4 changes: 3 additions & 1 deletion src_cpp/src_pdb/pdb/pdb_creator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,9 @@ namespace FakePDB::PDB {
}

bool PdbCreator::Commit(std::filesystem::path &path) {
std::filesystem::create_directories(path.parent_path());
std::filesystem::path dir = path.parent_path();
if (!dir.empty() && !std::filesystem::exists(dir))
std::filesystem::create_directories(dir);
auto guid = _pdbBuilder.getInfoBuilder().getGuid();
if (_pdbBuilder.commit(path.string(), &guid)) {
return false;
Expand Down

0 comments on commit d3856f3

Please sign in to comment.