Merge pull request #155 from HipByte/public

Compile `.strings` files. Closes #154.
This commit is contained in:
Eloy Durán
2014-04-17 16:45:33 +02:00

View File

@@ -454,7 +454,13 @@ EOS
if reserved_app_bundle_files.include?(res)
App.fail "Cannot use `#{res_path}' as a resource file because it's a reserved application bundle file"
end
copy_resource(res_path, File.join(app_resources_dir, res))
dest_path = File.join(app_resources_dir, res)
copy_resource(res_path, dest_path)
end
# Compile all .strings files
Dir.glob(File.join(app_resources_dir, '{,**/}*.strings')).each do |strings_file|
compile_resource_to_binary_plist(strings_file)
end
# Optional support for #eval (OSX-only).
@@ -511,6 +517,11 @@ EOS
end
end
def compile_resource_to_binary_plist(path)
App.info 'Compile', path
sh "/usr/bin/plutil -convert binary1 \"#{path}\""
end
def copy_resource(res_path, dest_path)
if !File.exist?(dest_path) or File.mtime(res_path) > File.mtime(dest_path)
FileUtils.mkdir_p(File.dirname(dest_path))