From ab198a227b7b599c276cf4c1b7b8f593bfe9b6cd Mon Sep 17 00:00:00 2001 From: Brad King <brad.king@kitware.com> Date: Mon, 12 Apr 2021 14:57:47 -0400 Subject: [PATCH] SystemTools: Return Status from GetShortPath --- SystemTools.cxx | 9 +++++---- SystemTools.hxx.in | 2 +- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/SystemTools.cxx b/SystemTools.cxx index 7965d4a..2ac9641 100644 --- a/SystemTools.cxx +++ b/SystemTools.cxx @@ -3971,7 +3971,8 @@ bool SystemToolsStatic::FileIsFullPath(const char* in_name, size_t len) return false; } -bool SystemTools::GetShortPath(const std::string& path, std::string& shortPath) +Status SystemTools::GetShortPath(std::string const& path, + std::string& shortPath) { #if defined(_WIN32) && !defined(__CYGWIN__) std::string tempPath = path; // create a buffer @@ -3991,14 +3992,14 @@ bool SystemTools::GetShortPath(const std::string& path, std::string& shortPath) } if (ret == 0) { - return false; + return Status::Windows_GetLastError(); } else { shortPath = Encoding::ToNarrow(&buffer[0]); - return true; + return Status::Success(); } #else shortPath = path; - return true; + return Status::Success(); #endif } diff --git a/SystemTools.hxx.in b/SystemTools.hxx.in index 7edb929..9274006 100644 --- a/SystemTools.hxx.in +++ b/SystemTools.hxx.in @@ -508,7 +508,7 @@ public: * For windows return the short path for the given path, * Unix just a pass through */ - static bool GetShortPath(const std::string& path, std::string& result); + static Status GetShortPath(std::string const& path, std::string& result); /** * Read line from file. Make sure to read a full line and truncates it if -- GitLab