From bd42a54500e1a9e6113813f808c7726a7c24c1ad Mon Sep 17 00:00:00 2001 From: Karen Arutyunov Date: Tue, 24 Oct 2017 13:18:23 +0300 Subject: Add workaround for MSYS2-based sha256sum utility issue --- bpkg/checksum.cxx | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) (limited to 'bpkg/checksum.cxx') diff --git a/bpkg/checksum.cxx b/bpkg/checksum.cxx index df7a546..f990ae5 100644 --- a/bpkg/checksum.cxx +++ b/bpkg/checksum.cxx @@ -7,6 +7,10 @@ #include // streamsize #include +#ifndef _WIN32 +# include // replace() +#endif + #include #include #include @@ -142,7 +146,19 @@ namespace bpkg for (const string& o: ops) args.push_back (o.c_str ()); - args.push_back (file.string ().c_str ()); + // By some reason, MSYS2-based sha256sum utility prints the redundant + // backslash character at the beginning of the sum. This somehow depends on + // the presence of backslashes in the file path, so we just get rid of + // them. + // +#ifndef _WIN32 + const string& f (file.string ()); +#else + string f (file.string ()); + replace (f.begin (), f.end (), '\\', '/'); +#endif + + args.push_back (f.c_str ()); args.push_back (nullptr); process_path pp (process::path_search (args[0])); -- cgit v1.1