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
1 changed files with 15 additions and 8 deletions

View File

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