Use std::vector rather than a raw array.
[dcpomatic.git] / src / lib / ext.cc
index 39c90ae124e0f547f0e4e48ae29436c8d20e7f65..feba68c1f6eec9c15951b1fa70cf010b6843fafd 100644 (file)
@@ -78,12 +78,14 @@ static
 void
 count (boost::filesystem::path dir, uint64_t& total_bytes)
 {
+       dir = fix_long_path (dir);
+
        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 {
-                       total_bytes += file_size (*i);
+                       total_bytes += file_size (i);
                }
        }
 }
@@ -218,6 +220,7 @@ 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());
+       from = fix_long_path (from);
 
        using namespace boost::filesystem;
 
@@ -301,10 +304,6 @@ try
        parts.division[2] = 0;
        parts.division[3] = 0;
 
-#ifdef DCPOMATIC_LINUX
-       PrivilegeEscalator e;
-#endif
-
        /* XXX: not sure if disk_id matters */
        int r = ext4_mbr_write (bd, &parts, 0);
        if (r) {