don't attempt copying resources if resources_dir doesn't exist

This commit is contained in:
Laurent Sansonetti
2011-12-13 20:40:33 +01:00
parent ad8ccdfc0c
commit cb2f7f2ff9

View File

@@ -173,15 +173,17 @@ EOS
File.open(File.join(bundle_path, 'PkgInfo'), 'w') { |io| io.write(config.pkginfo_data) }
# Copy resources, re-create subdirectories.
resources_files = Dir.chdir(config.resources_dir) do
Dir.glob('**/*').reject { |x| File.directory?(x) }
end
resources_files.each do |res|
res_path = File.join(config.resources_dir, res)
dest_path = File.join(bundle_path, res)
if !File.exist?(dest_path) or File.mtime(res_path) > File.mtime(dest_path)
FileUtils.mkdir_p(File.dirname(dest_path))
FileUtils.cp(res_path, File.dirname(dest_path))
if File.exist?(config.resources_dir)
resources_files = Dir.chdir(config.resources_dir) do
Dir.glob('**/*').reject { |x| File.directory?(x) }
end
resources_files.each do |res|
res_path = File.join(config.resources_dir, res)
dest_path = File.join(bundle_path, res)
if !File.exist?(dest_path) or File.mtime(res_path) > File.mtime(dest_path)
FileUtils.mkdir_p(File.dirname(dest_path))
FileUtils.cp(res_path, File.dirname(dest_path))
end
end
end
end