Skip to content

Commit

Permalink
Clarify VcpkgPaths initialization order and const-ify (#323)
Browse files Browse the repository at this point in the history
* Clarify VcpkgPaths initialization order and const-ify

* Fix Windows build

* Regen Loc
  • Loading branch information
ras0219-msft authored Jan 18, 2022
1 parent 018d568 commit 483cfe0
Show file tree
Hide file tree
Showing 4 changed files with 326 additions and 268 deletions.
37 changes: 13 additions & 24 deletions include/vcpkg/vcpkgpaths.h
Original file line number Diff line number Diff line change
Expand Up @@ -102,25 +102,21 @@ namespace vcpkg
const Path original_cwd;
const Path root;

Path manifest_root_dir;
Path downloads;
Path triplets;
Path community_triplets;
Path scripts;
Path prefab;

private:
Path builtin_ports;
const std::unique_ptr<details::VcpkgPathsImpl> m_pimpl;

public:
Path builtin_registry_versions;

Path tools;
Path buildsystems;
Path buildsystems_msbuild_targets;
Path buildsystems_msbuild_props;

Path ports_cmake;
const Path builtin_registry_versions;
const Path scripts;
const Path prefab;
const Path buildsystems;
const Path buildsystems_msbuild_targets;
const Path buildsystems_msbuild_props;
const Path downloads;
const Path tools;
const Path ports_cmake;
const Path triplets;
const Path community_triplets;

std::string get_toolver_diagnostics() const;

Expand Down Expand Up @@ -169,15 +165,8 @@ namespace vcpkg

// the directory of the builtin ports
// this should be used only for helper commands, not core commands like `install`.
Path builtin_ports_directory() const { return this->builtin_ports; }
const Path& builtin_ports_directory() const;

bool use_git_default_registry() const;

private:
Optional<Path> maybe_get_tmp_path(const std::string* arg_path,
StringLiteral root_subpath,
StringLiteral readonly_subpath,
LineInfo li) const;
std::unique_ptr<details::VcpkgPathsImpl> m_pimpl;
};
}
1 change: 1 addition & 0 deletions locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
"ErrorIndividualPackagesUnsupported": "Error: In manifest mode, `vcpkg install` does not support individual package arguments.\nTo install additional packages, edit vcpkg.json and then run `vcpkg install` without any package arguments.",
"ErrorInvalidClassicModeOption": "Error: The option {value} is not supported in classic mode and no manifest was found.",
"ErrorInvalidManifestModeOption": "Error: The option {value} is not supported in manifest mode.",
"ErrorMissingVcpkgRoot": "Error: Could not detect vcpkg-root. If you are trying to use a copy of vcpkg that you've built, you must define the VCPKG_ROOT environment variable to point to a cloned copy of {url}.",
"ErrorNoVSInstance": "Error: in triplet {triplet}: Unable to find a valid Visual Studio instance",
"ErrorNoVSInstanceAt": " at \"{path}\"",
"_ErrorNoVSInstanceAt.comment": "Printed after ErrorNoVSInstance on a separate line",
Expand Down
2 changes: 1 addition & 1 deletion src/vcpkg/install.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -850,7 +850,7 @@ namespace vcpkg::Install
}
if (failure)
{
msg::println(msgUsingManifestAt, msg::path = paths.manifest_root_dir / "vcpkg.json");
msg::println(msgUsingManifestAt, msg::path = paths.get_manifest_path().value_or_exit(VCPKG_LINE_INFO));
print2("\n");
print_usage(MANIFEST_COMMAND_STRUCTURE);
Checks::exit_fail(VCPKG_LINE_INFO);
Expand Down
Loading

0 comments on commit 483cfe0

Please sign in to comment.