From f743a881b27149b2f5542e8a0139e20b1ba8e05a Mon Sep 17 00:00:00 2001 From: gabime Date: Sun, 14 Jan 2024 13:17:27 +0200 Subject: [PATCH] merge pull #2978 --- src/details/os_windows.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/details/os_windows.cpp b/src/details/os_windows.cpp index b919796a..b458d6fd 100644 --- a/src/details/os_windows.cpp +++ b/src/details/os_windows.cpp @@ -105,11 +105,10 @@ int rename(const filename_t &filename1, const filename_t &filename2) noexcept { // Return true if path exists (file or directory) bool path_exists(const filename_t &filename) noexcept { #ifdef SPDLOG_WCHAR_FILENAMES - auto attribs = ::GetFileAttributesW(filename.c_str()); + return (::_wstat(filename.c_str(), &buffer) == 0); #else - auto attribs = ::GetFileAttributesA(filename.c_str()); + return (::_stat(filename.c_str(), &buffer) == 0); #endif - return attribs != INVALID_FILE_ATTRIBUTES; } #ifdef _MSC_VER