From 680b2928a1b7173f7fcb420612f5536a192f9ca3 Mon Sep 17 00:00:00 2001 From: Phoebe <20694052+PhoebeHui@users.noreply.github.com> Date: Wed, 19 Aug 2020 17:34:43 -0700 Subject: [PATCH] [vcpkg] Update hint message (#12976) --- toolsrc/src/vcpkg/build.cpp | 8 +++++++- toolsrc/src/vcpkg/commands.version.cpp | 10 ++++++++-- toolsrc/src/vcpkg/dependencies.cpp | 9 +++++++-- toolsrc/src/vcpkg/sourceparagraph.cpp | 8 ++++++-- toolsrc/src/vcpkg/update.cpp | 14 +++++++++++--- 5 files changed, 39 insertions(+), 10 deletions(-) diff --git a/toolsrc/src/vcpkg/build.cpp b/toolsrc/src/vcpkg/build.cpp index 4a9b945e7c..f163ef314d 100644 --- a/toolsrc/src/vcpkg/build.cpp +++ b/toolsrc/src/vcpkg/build.cpp @@ -1086,12 +1086,18 @@ namespace vcpkg::Build std::string create_user_troubleshooting_message(const PackageSpec& spec) { - return Strings::format("Please ensure you're using the latest portfiles with `.\\vcpkg update`, then\n" +#if defined(_WIN32) + auto vcpkg_update_cmd = ".\\vcpkg"; +#else + auto vcpkg_update_cmd = ".\/vcpkg"; +#endif + return Strings::format("Please ensure you're using the latest portfiles with `%s update`, then\n" "submit an issue at https://github.com/Microsoft/vcpkg/issues including:\n" " Package: %s\n" " Vcpkg version: %s\n" "\n" "Additionally, attach any relevant sections from the log files above.", + vcpkg_update_cmd, spec, Commands::Version::version()); } diff --git a/toolsrc/src/vcpkg/commands.version.cpp b/toolsrc/src/vcpkg/commands.version.cpp index 50ffc7c780..62f1d89c67 100644 --- a/toolsrc/src/vcpkg/commands.version.cpp +++ b/toolsrc/src/vcpkg/commands.version.cpp @@ -61,15 +61,21 @@ namespace vcpkg::Commands::Version { if (maj1 != maj2 || min1 != min2 || rev1 != rev2) { +#if defined(_WIN32) + auto bootstrap = ".\\bootstrap-vcpkg.bat"; +#else + auto bootstrap = ".\/bootstrap-vcpkg.sh"; +#endif System::printf(System::Color::warning, "Warning: Different source is available for vcpkg (%d.%d.%d -> %d.%d.%d). Use " - ".\\bootstrap-vcpkg.bat to update.\n", + "%s to update.\n", maj2, min2, rev2, maj1, min1, - rev1); + rev1, + bootstrap); } } } diff --git a/toolsrc/src/vcpkg/dependencies.cpp b/toolsrc/src/vcpkg/dependencies.cpp index 732ab46405..9b37fe6da0 100644 --- a/toolsrc/src/vcpkg/dependencies.cpp +++ b/toolsrc/src/vcpkg/dependencies.cpp @@ -257,13 +257,18 @@ namespace vcpkg::Dependencies { ExpectedS maybe_scfl = m_port_provider.get_control_file(ipv.spec().name()); - +#if defined(_WIN32) + auto vcpkg_remove_cmd = ".\\vcpkg"; +#else + auto vcpkg_remove_cmd = ".\/vcpkg"; +#endif if (!maybe_scfl) Checks::exit_with_message( VCPKG_LINE_INFO, - "Error: while loading %s: %s.\nPlease run \"vcpkg remove %s\" and re-attempt.", + "Error: while loading %s: %s.\nPlease run \"%s remove %s\" and re-attempt.", ipv.spec().to_string(), maybe_scfl.error(), + vcpkg_remove_cmd, ipv.spec().to_string()); return m_graph diff --git a/toolsrc/src/vcpkg/sourceparagraph.cpp b/toolsrc/src/vcpkg/sourceparagraph.cpp index e10e485a7f..ed26f4497e 100644 --- a/toolsrc/src/vcpkg/sourceparagraph.cpp +++ b/toolsrc/src/vcpkg/sourceparagraph.cpp @@ -179,8 +179,12 @@ namespace vcpkg System::print2("And this is the list of valid fields for manifest files: \n\n ", Strings::join("\n ", get_list_of_manifest_fields()), "\n\n"); - System::print2("You may need to update the vcpkg binary; try running bootstrap-vcpkg.bat or " - "bootstrap-vcpkg.sh to update.\n\n"); +#if defined(_WIN32) + auto bootstrap = ".\\bootstrap-vcpkg.bat"; +#else + auto bootstrap = ".\/bootstrap-vcpkg.sh"; +#endif + System::print2("You may need to update the vcpkg binary; try running %s to update.\n\n", bootstrap); } for (auto&& error_info : error_info_list) diff --git a/toolsrc/src/vcpkg/update.cpp b/toolsrc/src/vcpkg/update.cpp index 655c373682..2e88facfdb 100644 --- a/toolsrc/src/vcpkg/update.cpp +++ b/toolsrc/src/vcpkg/update.cpp @@ -74,13 +74,21 @@ namespace vcpkg::Update { System::printf(" %-32s %s\n", package.spec, package.version_diff.to_string()); } + +#if defined(_WIN32) + auto vcpkg_cmd = ".\\vcpkg"; +#else + auto vcpkg_cmd = ".\/vcpkg"; +#endif System::print2("\n" "To update these packages and all dependencies, run\n" - " .\\vcpkg upgrade\n" + " %s upgrade\n" "\n" "To only remove outdated packages, run\n" - " .\\vcpkg remove --outdated\n" - "\n"); + " %s remove --outdated\n" + "\n", + vcpkg_cmd, + vcpkg_cmd); } Checks::exit_success(VCPKG_LINE_INFO);