lib/magic/database.rb in magic-0.2.6 vs lib/magic/database.rb in magic-0.2.7
- old
+ new
@@ -27,9 +27,12 @@
Api.magic_load(@magic_set, database)
end
# Determine type of a file at given path
def file(filename)
+ if !File.exists?(filename)
+ raise Exception, "#{filename}: No such file or directory"
+ end
result = Api.magic_file(@magic_set, filename.to_s)
if result.null?
raise Exception, error
else
result.get_string(0)