aboutsummaryrefslogtreecommitdiff
path: root/toolsrc/src/vcpkg.cpp
diff options
context:
space:
mode:
authorAlexander Karatarakis <alkarata@microsoft.com>2017-10-14 02:07:42 -0700
committerAlexander Karatarakis <alkarata@microsoft.com>2017-10-14 02:07:42 -0700
commitbf41a93b9de45f5d407fd03a36096f2cd37902b4 (patch)
treeaf886c2095264a6b11ae7656abc85b3c9befd670 /toolsrc/src/vcpkg.cpp
parentfc1a24ad8bb3187d17341c967353c3cc9742317a (diff)
downloadvcpkg-bf41a93b9de45f5d407fd03a36096f2cd37902b4.tar.gz
vcpkg-bf41a93b9de45f5d407fd03a36096f2cd37902b4.zip
[vcpkg] Prefer the current vcpkg directory over the one the vcpkg.exe is located in
Diffstat (limited to 'toolsrc/src/vcpkg.cpp')
-rw-r--r--toolsrc/src/vcpkg.cpp11
1 files changed, 9 insertions, 2 deletions
diff --git a/toolsrc/src/vcpkg.cpp b/toolsrc/src/vcpkg.cpp
index 748b4f0ee..f1a86ae22 100644
--- a/toolsrc/src/vcpkg.cpp
+++ b/toolsrc/src/vcpkg.cpp
@@ -74,8 +74,14 @@ static void inner(const VcpkgCmdArguments& args)
}
else
{
- vcpkg_root_dir = Files::get_real_filesystem().find_file_recursively_up(
- fs::stdfs::absolute(System::get_exe_path_of_current_process()), ".vcpkg-root");
+ const fs::path current_path = fs::stdfs::current_path();
+ vcpkg_root_dir = Files::get_real_filesystem().find_file_recursively_up(current_path, ".vcpkg-root");
+
+ if (vcpkg_root_dir.empty())
+ {
+ vcpkg_root_dir = Files::get_real_filesystem().find_file_recursively_up(
+ fs::stdfs::absolute(System::get_exe_path_of_current_process()), ".vcpkg-root");
+ }
}
}
@@ -88,6 +94,7 @@ static void inner(const VcpkgCmdArguments& args)
vcpkg_root_dir.string(),
expected_paths.error().message());
const VcpkgPaths paths = expected_paths.value_or_exit(VCPKG_LINE_INFO);
+
const int exit_code = _wchdir(paths.root.c_str());
Checks::check_exit(VCPKG_LINE_INFO, exit_code == 0, "Changing the working dir failed");
Commands::Version::warn_if_vcpkg_version_mismatch(paths);