when copying resources, also re-create the subdirectory tree

This commit is contained in:
Laurent Sansonetti
2011-12-12 12:08:09 +01:00
parent 788351fa88
commit 675732498c

View File

@@ -172,11 +172,16 @@ EOS
# Create bundle/PkgInfo.
File.open(File.join(bundle_path, 'PkgInfo'), 'w') { |io| io.write(config.pkginfo_data) }
# Copy resources.
Dir.glob(File.join(config.resources_dir, '*')).each do |res_path|
dest_path = File.join(bundle_path, File.basename(res_path))
# 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)
sh "/bin/cp \"#{res_path}\" \"#{dest_path}\""
FileUtils.mkdir_p(File.dirname(dest_path))
FileUtils.cp(res_path, File.dirname(dest_path))
end
end
end