Use new Windows long filename workaround with disk writer (#1755).
authorCarl Hetherington <cth@carlh.net>
Thu, 22 Apr 2021 20:25:54 +0000 (22:25 +0200)
committerCarl Hetherington <cth@carlh.net>
Fri, 23 Apr 2021 15:44:14 +0000 (17:44 +0200)
src/lib/ext.cc

index 39c90ae124e0f547f0e4e48ae29436c8d20e7f65..b7481e293eae818d152ea9b9da1ec2b51b8ff9be 100644 (file)
@@ -78,12 +78,14 @@ static
 void
 count (boost::filesystem::path dir, uint64_t& total_bytes)
 {
 void
 count (boost::filesystem::path dir, uint64_t& total_bytes)
 {
+       dir = fix_long_path (dir);
+
        using namespace boost::filesystem;
        using namespace boost::filesystem;
-       for (directory_iterator i = directory_iterator(dir); i != directory_iterator(); ++i) {
-               if (is_directory(*i)) {
-                       count (*i, total_bytes);
+       for (auto i: directory_iterator(dir)) {
+               if (is_directory(i)) {
+                       count (i, total_bytes);
                } else {
                } else {
-                       total_bytes += file_size (*i);
+                       total_bytes += file_size (i);
                }
        }
 }
                }
        }
 }
@@ -218,6 +220,8 @@ void
 copy (boost::filesystem::path from, boost::filesystem::path to, uint64_t& total_remaining, uint64_t total, vector<CopiedFile>& copied_files, Nanomsg* nanomsg)
 {
        LOG_DISK ("Copy %1 -> %2", from.string(), to.generic_string());
 copy (boost::filesystem::path from, boost::filesystem::path to, uint64_t& total_remaining, uint64_t total, vector<CopiedFile>& copied_files, Nanomsg* nanomsg)
 {
        LOG_DISK ("Copy %1 -> %2", from.string(), to.generic_string());
+       from = fix_long_path (from);
+       to = fix_long_path (to);
 
        using namespace boost::filesystem;
 
 
        using namespace boost::filesystem;