diff options
| author | Martin Ridgers <[email protected]> | 2021-11-30 16:11:56 +0100 |
|---|---|---|
| committer | Martin Ridgers <[email protected]> | 2021-12-01 09:31:50 +0100 |
| commit | e565ea6cab86634c523acfa4448dd468dfb934a6 (patch) | |
| tree | d1abd07b08f00d3ac031b535e29cf5c4d46ee52f | |
| parent | Signed/unsigned warning fix (diff) | |
| download | zen-e565ea6cab86634c523acfa4448dd468dfb934a6.tar.xz zen-e565ea6cab86634c523acfa4448dd468dfb934a6.zip | |
Changed dedupe command to work with paths as utf8 strings
| -rw-r--r-- | zen/cmds/dedup.cpp | 36 |
1 files changed, 31 insertions, 5 deletions
diff --git a/zen/cmds/dedup.cpp b/zen/cmds/dedup.cpp index 09c614d03..7a6d82415 100644 --- a/zen/cmds/dedup.cpp +++ b/zen/cmds/dedup.cpp @@ -18,6 +18,32 @@ namespace zen { +//////////////////////////////////////////////////////////////////////////////// + +#if ZEN_PLATFORM_LINUX || ZEN_PLATFORM_MAC + +namespace Concurrency +{ + +template < + typename T0, + typename T1 +> +inline void parallel_invoke( + T0 const& t0, + T1 const& t1 + ) +{ + t0(); + t1(); +} + +} // Concurrency + +#endif // ZEN_PLATFORM_LINUX/MAC + +//////////////////////////////////////////////////////////////////////////////// + DedupCommand::DedupCommand() { m_Options.add_options()("h,help", "Print help"); @@ -256,8 +282,8 @@ DedupCommand::Run(const ZenCliOptions& GlobalOptions, int argc, char** argv) if (const std::filesystem::directory_entry* Dupe = DedupMap[Hash]) { - std::wstring FileA = Dupe->path().c_str(); - std::wstring FileB = Entry.path().c_str(); + std::string FileA = PathToUtf8(Dupe->path()); + std::string FileB = PathToUtf8(Entry.path()); size_t MinLen = std::min(FileA.size(), FileB.size()); auto Its = std::mismatch(FileB.rbegin(), FileB.rbegin() + MinLen, FileA.rbegin()); @@ -267,13 +293,13 @@ DedupCommand::Run(const ZenCliOptions& GlobalOptions, int argc, char** argv) if (Its.first[-1] == '\\' || Its.first[-1] == '/') --Its.first; - FileB = std::wstring(FileB.begin(), Its.first.base()) + L"..."; + FileB = std::string(FileB.begin(), Its.first.base()) + "..."; } ZEN_INFO("{} {} <-> {}", zen::NiceBytes(Entry.file_size()).c_str(), - Utf8Helper(FileA.c_str()).c_str(), - Utf8Helper(FileB.c_str()).c_str()); + FileA.c_str(), + FileB.c_str()); zen::CopyFileOptions Options; Options.EnableClone = true; |