From dc8cc945ee1904cafad36b38ad30febb88bb0ae2 Mon Sep 17 00:00:00 2001 From: KWSys Upstream Date: Wed, 12 Nov 2025 11:40:18 -0500 Subject: [PATCH] KWSys 2025-11-12 (1139f8a0) Code extracted from: https://gitlab.kitware.com/utils/kwsys.git at commit 1139f8a044044860e9a4c3b964750cbe68fe3f6d (master). Upstream Shortlog ----------------- Brad King (2): abb5ca15 SystemTools: Fix CopyFileIfNewer error status when source is missing 001e388f Directory: Restore Load() error for missing directory on Windows --- Directory.cxx | 4 ++-- SystemTools.cxx | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Directory.cxx b/Directory.cxx index b23c62414c..fae7761fdf 100644 --- a/Directory.cxx +++ b/Directory.cxx @@ -184,7 +184,7 @@ Status Directory::Load(std::string const& name, std::string* errorMessage) delete[] buf; if (srchHandle == INVALID_HANDLE_VALUE) { - Status status = Status::POSIX_errno(); + Status status = Status::Windows_GetLastError(); if (errorMessage) { *errorMessage = status.GetString(); } @@ -198,7 +198,7 @@ Status Directory::Load(std::string const& name, std::string* errorMessage) } while (FindNextFileW(srchHandle, &data)); this->Internal->Path = name; if (!FindClose(srchHandle)) { - Status status = Status::POSIX_errno(); + Status status = Status::Windows_GetLastError(); if (errorMessage) { *errorMessage = status.GetString(); } diff --git a/SystemTools.cxx b/SystemTools.cxx index 9d4e40b657..ff1dfe6c49 100644 --- a/SystemTools.cxx +++ b/SystemTools.cxx @@ -2273,7 +2273,7 @@ SystemTools::CopyStatus SystemTools::CopyFileIfNewer( // source and destination are files so do a copy if source is newer // Check if source file exists first if (!SystemTools::FileExists(source)) { - return CopyStatus{ Status::POSIX_errno(), CopyStatus::SourcePath }; + return CopyStatus{ Status::POSIX(ENOENT), CopyStatus::SourcePath }; } // If destination doesn't exist, always copy if (!SystemTools::FileExists(destination)) {