about summary refs log tree commit diff stats
path: root/code
diff options
context:
space:
mode:
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!