lib/vfs/storages/local.rb in vfs-0.1.0 vs lib/vfs/storages/local.rb in vfs-0.1.1

- old
+ new

@@ -17,10 +17,14 @@ def attributes path stat = ::File.stat path attrs = {} attrs[:file] = stat.file? attrs[:dir] = stat.directory? + + # attributes special for file system + attrs[:created_at] = stat.ctime + attrs[:updated_at] = stat.mtime attrs rescue Errno::ENOENT {} end @@ -66,21 +70,23 @@ def delete_dir path FileUtils.rm_r path end - def each path, &block + def each_entry path, &block ::Dir.foreach path do |relative_name| next if relative_name == '.' or relative_name == '..' if ::File.directory? "#{path}/#{relative_name}" block.call relative_name, :dir else block.call relative_name, :file end end end - def efficient_dir_copy from, to + def efficient_dir_copy from, to, override + return false if override # FileUtils.cp_r doesn't support this behaviour + from.storage.open_fs do |from_fs| to.storage.open_fs do |to_fs| if from_fs.local? and to_fs.local? FileUtils.cp_r from.path, to.path true \ No newline at end of file