mirror of
https://github.com/zhigang1992/RubyMotion.git
synced 2026-06-20 03:59:11 +08:00
convert a string encoding which retrieved from filesystem
The OSX filesystem uses UTF8-MAC as file name encoding. Its encoding has a character that does not match UTF-8 encoding. (ex, "が" in Japanese)
This commit is contained in:
@@ -456,6 +456,7 @@ EOS
|
||||
# Delete old resource files.
|
||||
Dir.chdir(bundle_path) do
|
||||
Dir.glob('**/*').each do |bundle_res|
|
||||
bundle_res = convert_filesystem_encoding(bundle_res)
|
||||
next if File.directory?(bundle_res)
|
||||
next if reserved_app_bundle_files.include?(bundle_res)
|
||||
next if resources_files.include?(bundle_res)
|
||||
@@ -478,6 +479,16 @@ EOS
|
||||
end
|
||||
end
|
||||
|
||||
def convert_filesystem_encoding(string)
|
||||
begin
|
||||
string.encode("UTF-8", "UTF8-MAC")
|
||||
rescue
|
||||
# for Ruby 1.8
|
||||
require 'iconv'
|
||||
Iconv.conv("UTF-8", "UTF8-MAC", string)
|
||||
end
|
||||
end
|
||||
|
||||
def codesign(config, platform)
|
||||
bundle_path = config.app_bundle(platform)
|
||||
raise unless File.exist?(bundle_path)
|
||||
|
||||
Reference in New Issue
Block a user