about summary refs log tree commit diff stats
path: root/code/action.rb
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/action.rb
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/action.rb')
-rw-r--r--code/action.rb18
1 files changed, 18 insertions, 0 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