Skip to content

Commit ab7225c

Browse files
committed
Vcpkg: Prefer environment variable over executable path
The executable can be in a different directory. Change-Id: Ie630d464734d1ef9d0a9e1adfb8da8e56c67b5dd Reviewed-by: Alessandro Portale <[email protected]>
1 parent 09322f4 commit ab7225c

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

src/plugins/vcpkg/vcpkgsettings.cpp

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,10 +35,12 @@ VcpkgSettings::VcpkgSettings()
3535

3636
vcpkgRoot.setSettingsKey("VcpkgRoot");
3737
vcpkgRoot.setExpectedKind(PathChooser::ExistingDirectory);
38-
FilePath defaultPath = Environment::systemEnvironment().searchInPath(Constants::VCPKG_COMMAND)
39-
.parentDir();
38+
FilePath defaultPath = FilePath::fromUserInput(
39+
qtcEnvironmentVariable(Constants::ENVVAR_VCPKG_ROOT));
40+
4041
if (!defaultPath.isDir())
41-
defaultPath = FilePath::fromUserInput(qtcEnvironmentVariable(Constants::ENVVAR_VCPKG_ROOT));
42+
defaultPath = Environment::systemEnvironment().searchInPath(Constants::VCPKG_COMMAND).parentDir();
43+
4244
if (defaultPath.isDir())
4345
vcpkgRoot.setDefaultPathValue(defaultPath);
4446

0 commit comments

Comments
 (0)