From 643cec753410ad58aa77b2ef4af9872c86955040 Mon Sep 17 00:00:00 2001 From: Ilya Andreev Date: Wed, 23 Oct 2024 21:22:15 +0300 Subject: [PATCH] Do not try to create entry again if failed (#134) 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 --- src/directory.cpp | 4 ---- src/file.cpp | 4 ---- 2 files changed, 8 deletions(-) diff --git a/src/directory.cpp b/src/directory.cpp index 24c8858..1dd064e 100644 --- a/src/directory.cpp +++ b/src/directory.cpp @@ -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 diff --git a/src/file.cpp b/src/file.cpp index e33238a..3385ab2 100644 --- a/src/file.cpp +++ b/src/file.cpp @@ -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