From e0385d5e3fd8bdd160ff959c0950a8f351d39a7b Mon Sep 17 00:00:00 2001 From: Karen Arutyunov Date: Mon, 9 Sep 2024 16:29:14 +0300 Subject: Fix path_entry() not to fail for non-existent drives on Windows --- libbutl/filesystem.cxx | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/libbutl/filesystem.cxx b/libbutl/filesystem.cxx index 28a0de8..3153e77 100644 --- a/libbutl/filesystem.cxx +++ b/libbutl/filesystem.cxx @@ -268,7 +268,15 @@ namespace butl ec == ERROR_INVALID_NAME || ec == ERROR_INVALID_DRIVE || ec == ERROR_BAD_PATHNAME || - ec == ERROR_BAD_NETPATH; + ec == ERROR_BAD_NETPATH || + // + // Note that for reasons unknown, filesystem entry stat functions + // (GetFileAttributesExA(), etc) may end up with the + // ERROR_NOT_READY error code rather than ERROR_INVALID_DRIVE for + // paths on non-existent drives. Thus, we treat the ERROR_NOT_READY + // error code in the same way as ERROR_INVALID_DRIVE here. + // + ec == ERROR_NOT_READY; } static inline bool -- cgit v1.1