Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Better error messages when xml2esf used the wrong way

  • Loading branch information...
commit 26eddef271502d5c573273ca6a7c2f078c503de5 1 parent 82e0623
@taw authored
Showing with 7 additions and 1 deletion.
  1. +7 −1 esfxml/xml2esf
View
8 esfxml/xml2esf
@@ -1380,11 +1380,17 @@ class Xml2Esf < Nokogiri::XML::SAX::Document
end
end
-unless ARGV.size == 2
+def usage!(msg=nil)
+ STDERR.puts msg if msg
STDERR.puts "Usage: #{$0} input_dir output.esf"
exit 1
end
+usage! unless ARGV.size == 2
+usage! "Error: #{ARGV[0]} not found" unless File.exist?(ARGV[0])
+usage! "Error: #{ARGV[0]} is not directory" unless File.directory?(ARGV[0])
+usage! "Error: #{ARGV[1]} is a directory" if File.directory?(ARGV[1])
+
in_dir = ARGV[0]
out_file = File.open(ARGV[1], 'wb')
Please sign in to comment.
Something went wrong with that request. Please try again.