vgorloff / swift-everywhere-toolchain

Automated workflow to compile Swift Toolchain, for making Android apps with Swift.
MIT License
85 stars 25 forks source link

Main bundle path #68

Closed Molanda closed 4 years ago

Molanda commented 5 years ago

For Android, the main bundle path is set to the executable directory, which is something like /system/bin/app_process32. As a result, things like localized strings do not work.

This PR allows the bundle path to be set by the CFFIXED_USER_HOME environmental variable.

In my case, I set this as follows...

Os.setenv("CFFIXED_USER_HOME", mainActivity.filesDir.path, true)

I then copy the files from the asset manager into the files directory. This includes Info.plist which configures the bundle identifier and development region, and en.lproj/Localizable.strings which contain the English strings.

Once these are in place, I can call NSLocalizedString to get the string.

Molanda commented 4 years ago

This has been merged to swift-corelibs-foundation with PR #2520.