diff options
| author | ruki <[email protected]> | 2020-04-11 00:40:18 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2020-04-10 22:01:49 +0800 |
| commit | 2b101733d039a1a2d437165f033976a2927f161c (patch) | |
| tree | 0f87cc119093397879c4fdfe82e0c0e52d71ff17 | |
| parent | 9e69438ac517bdb38827d11b247f0f758ac17dcb (diff) | |
replace bundle id for resign
| -rw-r--r-- | xmake/modules/utils/ipa/resign.lua | 20 |
1 files changed, 18 insertions, 2 deletions
diff --git a/xmake/modules/utils/ipa/resign.lua b/xmake/modules/utils/ipa/resign.lua index e3c1dcf92..b7488edb0 100644 --- a/xmake/modules/utils/ipa/resign.lua +++ b/xmake/modules/utils/ipa/resign.lua @@ -57,9 +57,25 @@ function _resign_app(appdir, codesign_identity, mobile_provision, bundle_identif end end - -- TODO replace bundle identifier of Info.plist + -- replace bundle identifier of Info.plist if bundle_identifier then - -- TODO + local info_plist_file = path.join(appdir, "Info.plist") + if os.isfile(info_plist_file) then + local info_plist_data = io.readfile(info_plist_file) + if info_plist_data then + local p = info_plist_data:find("<key>CFBundleIdentifier</key>", 1, true) + if p then + local e = info_plist_data:find("</string>", p, true) + if e then + local block = info_plist_data:sub(p, e + 9):match("<string>(.+)</string>") + if block then + info_plist_data = info_plist_data:gsub(block, bundle_identifier) + io.writefile(info_plist_file, info_plist_data) + end + end + end + end + end end -- do codesign |
