mirror of
https://github.com/Kitware/CMake.git
synced 2026-02-11 09:39:49 -06:00
cmSystemTools: Remove redundant filesystem access on Windows
Since commit 823e1df54c (cmSystemTools: Implement GetRealPath on
Windows, 2024-11-04), GetRealPath now returns the actual case
on disk. It also returns the original path on failure.
This commit is contained in:
@@ -2689,12 +2689,9 @@ void cmSystemTools::FindCMakeResources(const char* argv0)
|
|||||||
(void)argv0; // ignore this on windows
|
(void)argv0; // ignore this on windows
|
||||||
wchar_t modulepath[_MAX_PATH];
|
wchar_t modulepath[_MAX_PATH];
|
||||||
::GetModuleFileNameW(nullptr, modulepath, sizeof(modulepath));
|
::GetModuleFileNameW(nullptr, modulepath, sizeof(modulepath));
|
||||||
std::string path = cmsys::Encoding::ToNarrow(modulepath);
|
std::string exe = cmsys::Encoding::ToNarrow(modulepath);
|
||||||
std::string realPath = cmSystemTools::GetRealPath(path, nullptr);
|
exe = cmSystemTools::GetRealPath(exe);
|
||||||
if (realPath.empty()) {
|
exe_dir = cmSystemTools::GetFilenamePath(exe);
|
||||||
realPath = path;
|
|
||||||
}
|
|
||||||
exe_dir = cmSystemTools::GetFilenamePath(realPath);
|
|
||||||
#elif defined(__APPLE__)
|
#elif defined(__APPLE__)
|
||||||
(void)argv0; // ignore this on OS X
|
(void)argv0; // ignore this on OS X
|
||||||
# define CM_EXE_PATH_LOCAL_SIZE 16384
|
# define CM_EXE_PATH_LOCAL_SIZE 16384
|
||||||
@@ -2738,7 +2735,6 @@ void cmSystemTools::FindCMakeResources(const char* argv0)
|
|||||||
// ???
|
// ???
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
exe_dir = cmSystemTools::GetActualCaseForPath(exe_dir);
|
|
||||||
cmSystemToolsCMakeCommand =
|
cmSystemToolsCMakeCommand =
|
||||||
cmStrCat(exe_dir, "/cmake", cmSystemTools::GetExecutableExtension());
|
cmStrCat(exe_dir, "/cmake", cmSystemTools::GetExecutableExtension());
|
||||||
#ifdef CMAKE_BOOTSTRAP
|
#ifdef CMAKE_BOOTSTRAP
|
||||||
|
|||||||
Reference in New Issue
Block a user