lib/bukkit/new.rb in bukkit-0.0.5 vs lib/bukkit/new.rb in bukkit-0.0.7
- old
+ new
@@ -34,9 +34,13 @@
def create_folder
opt2 = ARGV[1]
if opt2.nil?
abort(" Server name not specified.\n USAGE: 'bukkit new SERVERNAME'")
else
- Dir.mkdir(opt2.to_s)
- Dir.chdir(opt2.to_s)
+ begin
+ Dir.mkdir(opt2.to_s)
+ Dir.chdir(opt2.to_s)
+ rescue Errno::EEXIST
+ abort(" Directory already exists. Try a different name.")
+ end
end
end
\ No newline at end of file