Validate that files exist before attempting to copy them to reduce errors

This commit is contained in:
ViViDboarder 2013-07-03 11:18:25 -07:00
parent 2071363d2c
commit 21af11b4ff

View File

@ -98,16 +98,23 @@ module AbuseTheForce
FileUtils.mkdir_p File.join(temp_path, mdir) FileUtils.mkdir_p File.join(temp_path, mdir)
# Copy the file # Copy the file
FileUtils.copy( if File.exists? fpath
File.join(fpath), FileUtils.copy(
File.join(temp_path, mdir, '/') File.join(fpath),
) File.join(temp_path, mdir, '/')
)
else
pute("File not found...")
return false
end
# Copy the metadata # Copy the metadata
FileUtils.copy( if File.exists? fpath + '-meta.xml'
File.join(fpath + '-meta.xml'), FileUtils.copy(
File.join(temp_path, mdir, '/') File.join(fpath + '-meta.xml'),
) File.join(temp_path, mdir, '/')
)
end
return true return true
end end