about summary refs log tree commit diff stats
path: root/code
diff options
context:
space:
mode:
authorhut <hut@lavabit.com>2009-07-29 18:58:31 +0200
committerhut <hut@lavabit.com>2009-07-29 18:58:31 +0200
commita6e2468a9a34838e26a7f4e69b372af147250b98 (patch)
tree37a163d4dbf1cb5ccea67671c7cc60cccc1e28a7 /code
parentc5b816b28209dce887a98da93f119a03caac5eb5 (diff)
downloadranger-a6e2468a9a34838e26a7f4e69b372af147250b98.tar.gz
fixed occasional failure of deletion
when Fileutils.remove_entry_secure() fails, use a simple
FileUtils.remove_entry().
Diffstat (limited to 'code')
-rw-r--r--code/action.rb18
-rw-r--r--code/keys.rb4
2 files changed, 19 insertions, 3 deletions
diff --git a/code/action.rb b/code/action.rb
index 76a0e361..89d27bb3 100644
--- a/code/action.rb
+++ b/code/action.rb
@@ -73,5 +73,23 @@ module Action
 		print "Press [ENTER] to continue..."
 		$stdin.gets
 	end
+
+	def delete!(*entries)
+		for file in entries
+			if file.is_a? Directory::Entry
+				file = file.path
+			end
+
+			begin
+				FileUtils.remove_entry_secure(file)
+			rescue
+				begin
+					FileUtils.remove_entry(file)
+				rescue
+					lograise
+				end
+			end
+		end
+	end
 end
 
diff --git a/code/keys.rb b/code/keys.rb
index b76a9c7d..6d4226b4 100644
--- a/code/keys.rb
+++ b/code/keys.rb
@@ -102,9 +102,7 @@ module Fm
 
 		## delete recursively forever
 		when 'delete' + Option.confirm_string
-			for file in selection
-				FileUtils.remove_entry_secure(file.path) rescue lograise
-			end
+			Action.delete! *selection
 			@marked.clear
 			@pwd.refresh!