aboutsummaryrefslogtreecommitdiff
path: root/toolsrc/src/commands_hash.cpp
diff options
context:
space:
mode:
authorRobert Schumacher <roschuma@microsoft.com>2017-10-13 18:37:41 -0700
committerRobert Schumacher <roschuma@microsoft.com>2017-10-13 18:37:41 -0700
commite17de99599a2f114faab1bb4821fbaad4d266c95 (patch)
tree397fec8a85af3ef002c125ce013eceb60d27116d /toolsrc/src/commands_hash.cpp
parent1fb5313a881fe0fcfd90dff5255045c8367ee00b (diff)
downloadvcpkg-e17de99599a2f114faab1bb4821fbaad4d266c95.tar.gz
vcpkg-e17de99599a2f114faab1bb4821fbaad4d266c95.zip
[vcpkg] Re-layout all files using new organization scheme.
All filenames and directories are lowercase. Use dots for namespace separation.
Diffstat (limited to 'toolsrc/src/commands_hash.cpp')
-rw-r--r--toolsrc/src/commands_hash.cpp55
1 files changed, 0 insertions, 55 deletions
diff --git a/toolsrc/src/commands_hash.cpp b/toolsrc/src/commands_hash.cpp
deleted file mode 100644
index b3211b9f8..000000000
--- a/toolsrc/src/commands_hash.cpp
+++ /dev/null
@@ -1,55 +0,0 @@
-#include "pch.h"
-
-#include "vcpkg_Commands.h"
-#include "vcpkg_System.h"
-#include "vcpkg_Util.h"
-
-namespace vcpkg::Commands::Hash
-{
- static void do_file_hash(fs::path const& path, std::wstring const& hash_type)
- {
- const auto cmd_line = Strings::wformat(LR"(CertUtil.exe -hashfile "%s" %s)", path.c_str(), hash_type);
- const auto ec_data = System::cmd_execute_and_capture_output(cmd_line);
- Checks::check_exit(
- VCPKG_LINE_INFO, ec_data.exit_code == 0, "Running command:\n %s\n failed", Strings::to_utf8(cmd_line));
-
- std::string const& output = ec_data.output;
-
- const auto start = output.find_first_of("\r\n");
- Checks::check_exit(VCPKG_LINE_INFO,
- start != std::string::npos,
- "Unexpected output format from command: %s",
- Strings::to_utf8(cmd_line));
-
- const auto end = output.find_first_of("\r\n", start + 1);
- Checks::check_exit(VCPKG_LINE_INFO,
- end != std::string::npos,
- "Unexpected output format from command: %s",
- Strings::to_utf8(cmd_line));
-
- auto hash = output.substr(start, end - start);
- Util::erase_remove_if(hash, isspace);
- System::println(hash);
- }
-
- void perform_and_exit(const VcpkgCmdArguments& args)
- {
- static const std::string EXAMPLE =
- Strings::format("The argument should be a file path\n%s",
- Commands::Help::create_example_string("hash boost_1_62_0.tar.bz2"));
- args.check_min_arg_count(1, EXAMPLE);
- args.check_max_arg_count(2, EXAMPLE);
- args.check_and_get_optional_command_arguments({});
-
- if (args.command_arguments.size() == 1)
- {
- do_file_hash(args.command_arguments[0], L"SHA512");
- }
- if (args.command_arguments.size() == 2)
- {
- do_file_hash(args.command_arguments[0], Strings::to_utf16(args.command_arguments[1]));
- }
-
- Checks::exit_success(VCPKG_LINE_INFO);
- }
-}