Skip to content

Commit

Permalink
[vcpkg] Continue on malformed paths in PATH (microsoft#8129)
Browse files Browse the repository at this point in the history
Previously vcpkg would exit on malformed paths. We now will continue and ignore the malformed path.
  • Loading branch information
Phoebe authored and cbezault committed Sep 17, 2019
1 parent 08192ec commit 5185708
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/vcpkg/base/files.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -667,13 +668,14 @@ namespace vcpkg::Files
auto paths = Strings::split(System::get_environment_variable("PATH").value_or_exit(VCPKG_LINE_INFO), ";");

std::vector<fs::path> 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');
Expand Down

0 comments on commit 5185708

Please sign in to comment.