about summary refs log tree commit diff stats
path: root/code
diff options
context:
space:
mode:
authorhut <hut@lavabit.com>2009-07-06 17:44:34 +0200
committerhut <hut@lavabit.com>2009-07-06 17:44:34 +0200
commit4ed0c6e8cd44b32e7bbe4935dd20fc7554166fac (patch)
tree83f2e7dc5b18df4365a1e41fa2e61ffc87adf673 /code
parenta126029a240e3d18a69eccd797d9b4656c2e1760 (diff)
downloadranger-4ed0c6e8cd44b32e7bbe4935dd20fc7554166fac.tar.gz
rely less on system calls for mkdir/touch
Diffstat (limited to 'code')
-rw-r--r--code/keys.rb14
1 files changed, 8 insertions, 6 deletions
diff --git a/code/keys.rb b/code/keys.rb
index e4f33e2d..21a6335e 100644
--- a/code/keys.rb
+++ b/code/keys.rb
@@ -83,9 +83,10 @@ module Fm
 			if str =~ /^\s?(.*)(<cr>|<esc>)$/
 				@buffer = ''
 				if $2 == '<cr>'
-					closei
-					system('mkdir', $1)
-					starti
+					begin
+						Dir.mkdir($1)
+					rescue
+					end
 					@pwd.schedule
 				end
 			end
@@ -95,9 +96,10 @@ module Fm
 			if str =~ /^\s?(.*)(<cr>|<esc>)$/
 				@buffer = ''
 				if $2 == '<cr>'
-#					closei
-					system('touch', $1)
-#					starti
+					begin
+						File.open($1, 'a').close
+					rescue
+					end
 					@pwd.schedule
 				end
 			end