Skip to content

Commit

Permalink
Do not try to create entry again if failed (#134)
Browse files Browse the repository at this point in the history
Since we are using a GUID that is guaranteed not to overlap on the same
machine, there is no point in checking if we have hit an existing file
when trying to create a new one
  • Loading branch information
bugdea1er authored Oct 23, 2024
1 parent 8cb2302 commit 643cec7
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 8 deletions.
4 changes: 0 additions & 4 deletions src/directory.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,6 @@ create_directory(std::string_view label) {
#ifdef _WIN32
if (!CreateDirectoryW(path.c_str(), nullptr)) {
DWORD err = GetLastError();
if (err == ERROR_ALREADY_EXISTS) {
return create_directory(label);
}

ec = std::error_code(err, std::system_category());
}
#else
Expand Down
4 changes: 0 additions & 4 deletions src/file.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,6 @@ create_file(std::string_view label, std::string_view extension) {

if (handle == INVALID_HANDLE_VALUE) {
DWORD err = GetLastError();
if (err == ERROR_ALREADY_EXISTS) {
return create_file(label, extension);
}

ec = std::error_code(err, std::system_category());
}
#else
Expand Down

0 comments on commit 643cec7

Please sign in to comment.