From b4a0c8d57453cd77c5958800c345e6fd9938f0a4 Mon Sep 17 00:00:00 2001 From: Phoebe <925731795@qq.com> Date: Wed, 18 Sep 2019 00:35:50 +0800 Subject: [vcpkg] Continue on malformed paths in PATH (#8129) Previously vcpkg would exit on malformed paths. We now will continue and ignore the malformed path. --- toolsrc/src/vcpkg/base/files.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'toolsrc/src') diff --git a/toolsrc/src/vcpkg/base/files.cpp b/toolsrc/src/vcpkg/base/files.cpp index 5ebe8d834..3d7df1a68 100644 --- a/toolsrc/src/vcpkg/base/files.cpp +++ b/toolsrc/src/vcpkg/base/files.cpp @@ -185,6 +185,7 @@ namespace vcpkg::Files if (ec) Checks::exit_with_message(li, "error checking existence of file %s: %s", path.u8string(), ec.message()); return result; } + bool Filesystem::exists(const fs::path& path) const { std::error_code ec; @@ -667,13 +668,14 @@ namespace vcpkg::Files auto paths = Strings::split(System::get_environment_variable("PATH").value_or_exit(VCPKG_LINE_INFO), ";"); std::vector ret; + std::error_code ec; for (auto&& path : paths) { auto base = path + "/" + name; for (auto&& ext : EXTS) { auto p = fs::u8path(base + ext.c_str()); - if (Util::find(ret, p) == ret.end() && this->exists(VCPKG_LINE_INFO, p)) + if (Util::find(ret, p) == ret.end() && this->exists(p, ec)) { ret.push_back(p); Debug::print("Found path: ", p.u8string(), '\n'); -- cgit v1.2.3