print a useful message instead of nothing when the given file doesn't exist

git-svn-id: file:///home/svn/framework3/trunk@8092 4d416f70-5f16-0410-b530-b9f4589650da
unstable
James Lee 2010-01-10 17:49:28 +00:00
parent f29402028e
commit e1ba7b9618
1 changed files with 8 additions and 3 deletions

View File

@ -836,7 +836,12 @@ class Db
return
end
args.each { |glob|
Dir.glob(File.expand_path(glob)).each { |filename|
files = Dir.glob(File.expand_path(glob))
if files.empty?
print_error("No such file #{glob}")
next
end
files.each { |filename|
if (not File.readable?(filename))
print_error("Could not read file #{filename}")
next
@ -845,8 +850,8 @@ class Db
framework.db.import_file(filename)
print_status("Successfully imported #{filename}")
rescue DBImportError
print_error("Failed to import #{filename}: #{$!.class}: #{$!}")
elog("Failed to import #{filename}: #{$!.class}: #{$!}", LEV_1)
print_error("Failed to import #{filename}: #{$!}")
elog("Failed to import #{filename}: #{$!.class}: #{$!}")
dlog("Call stack: #{$@.join("\n")}", LEV_3)
next
end