diff options
author | Matt Jaeger <majaeger@microsoft.com> | 2021-03-25 18:56:36 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2021-03-25 19:49:48 (GMT) |
commit | 2fe39dc30614f8fd7d0c37a68e8e7e3eb20f445a (patch) | |
tree | 77ce14525ebf86393d0409b8a40861fb224b5f37 | |
parent | 0020f69848e6a80858e9b56fc351d7644cff6e4d (diff) | |
download | CMake-2fe39dc30614f8fd7d0c37a68e8e7e3eb20f445a.zip CMake-2fe39dc30614f8fd7d0c37a68e8e7e3eb20f445a.tar.gz CMake-2fe39dc30614f8fd7d0c37a68e8e7e3eb20f445a.tar.bz2 |
cmake: Fix loading CMake sources from long paths on Windows
Pass a Windows extended path to the lexer so it can open long paths.
-rw-r--r-- | Source/cmListFileCache.cxx | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/Source/cmListFileCache.cxx b/Source/cmListFileCache.cxx index 1464a14..5c3a034 100644 --- a/Source/cmListFileCache.cxx +++ b/Source/cmListFileCache.cxx @@ -7,6 +7,10 @@ #include <sstream> #include <utility> +#ifdef _WIN32 +# include <cmsys/Encoding.hxx> +#endif + #include "cmListFileLexer.h" #include "cmMessageType.h" #include "cmMessenger.h" @@ -83,9 +87,15 @@ bool cmListFileParser::ParseFile(const char* filename) { this->FileName = filename; +#ifdef _WIN32 + std::string expandedFileName = cmsys::Encoding::ToNarrow( + cmSystemTools::ConvertToWindowsExtendedPath(filename)); + filename = expandedFileName.c_str(); +#endif + // Open the file. cmListFileLexer_BOM bom; - if (!cmListFileLexer_SetFileName(this->Lexer, this->FileName, &bom)) { + if (!cmListFileLexer_SetFileName(this->Lexer, filename, &bom)) { this->IssueFileOpenError("cmListFileCache: error can not open file."); return false; } |