# # # patch "file_io.cc" # from [6c9c825346a1256c0e83b52302512ea39e1687b8] # to [b97d1e90999a507d904c984a04c276b80fb388e5] # # patch "file_io.hh" # from [ef464b88aa3e6c608bacddb2a77542401202a349] # to [95244031bc7f0bc2a50de9998ee4543a9070ba53] # # patch "work.cc" # from [d188554b61b9009b314eae843592b1f25640ab21] # to [e55514ea245861a8739eb40cb120afe12c99ad6e] # ============================================================ --- file_io.cc 6c9c825346a1256c0e83b52302512ea39e1687b8 +++ file_io.cc b97d1e90999a507d904c984a04c276b80fb388e5 @@ -347,7 +347,7 @@ dat = tmp2; } -void read_directory(system_path const & path, +void read_directory(any_path const & path, std::vector & files, std::vector & dirs) { @@ -363,6 +363,8 @@ || di->string() == "..") continue; + // FIXME: BUG: this screws up charsets (assumes blindly that the fs is + // utf8) if (fs::is_directory(entry)) dirs.push_back(utf8(entry.leaf())); else ============================================================ --- file_io.hh ef464b88aa3e6c608bacddb2a77542401202a349 +++ file_io.hh 95244031bc7f0bc2a50de9998ee4543a9070ba53 @@ -63,9 +63,6 @@ void move_dir(any_path const & old_path, any_path const & new_path); -void move_dir_contents(any_path const & old_path, - any_path const & new_path); - // calls move_file or move_dir as appropriate void move_path(any_path const & old_path, any_path const & new_path); @@ -75,7 +72,7 @@ data & dat, lua_hooks & lua); -void read_directory(system_path const & path, +void read_directory(any_path const & path, std::vector & files, std::vector & dirs); ============================================================ --- work.cc d188554b61b9009b314eae843592b1f25640ab21 +++ work.cc e55514ea245861a8739eb40cb120afe12c99ad6e @@ -822,7 +822,13 @@ { // root dir detach, so we move contents, rather than the dir itself mkdir_p(dst_pth); - move_dir_contents(src_pth, dst_pth); + std::vector files, dirs; + read_directory(src_pth, files, dirs); + for (std::vector::const_iterator i = files.begin(); i != files.end(); ++i) + move_file(src_pth / (*i)(), dst_pth / (*i)()); + for (std::vector::const_iterator i = files.begin(); i != files.end(); ++i) + if (!bookkeeping_path::is_bookkeeping_path((*i)())) + move_dir(src_pth / (*i)(), dst_pth / (*i)()); root_dir_attached = false; } else @@ -906,7 +912,18 @@ if (dst_pth == file_path()) { // root dir attach, so we move contents, rather than the dir itself - move_dir_contents(src_pth, dst_pth); + std::vector files, dirs; + read_directory(src_pth, files, dirs); + for (std::vector::const_iterator i = files.begin(); i != files.end(); ++i) + { + I(!bookkeeping_path::is_bookkeeping_path((*i)())); + move_file(src_pth / (*i)(), dst_pth / (*i)()); + } + for (std::vector::const_iterator i = files.begin(); i != files.end(); ++i) + { + I(!bookkeeping_path::is_bookkeeping_path((*i)())); + move_dir(src_pth / (*i)(), dst_pth / (*i)()); + } delete_dir_shallow(src_pth); root_dir_attached = true; }