mirror of
https://github.com/apache/cordova-android.git
synced 2025-01-19 07:02:51 +08:00
[CB-10916] Support display name for Android
This commit is contained in:
parent
76dd8613ca
commit
22645d9158
9
bin/templates/cordova/lib/prepare.js
vendored
9
bin/templates/cordova/lib/prepare.js
vendored
@ -167,9 +167,16 @@ function cleanWww (projectRoot, locations) {
|
||||
*/
|
||||
function updateProjectAccordingTo (platformConfig, locations) {
|
||||
// Update app name by editing res/values/strings.xml
|
||||
var name = platformConfig.name();
|
||||
var strings = xmlHelpers.parseElementtreeSync(locations.strings);
|
||||
|
||||
var name = platformConfig.name();
|
||||
strings.find('string[@name="app_name"]').text = name.replace(/\'/g, '\\\'');
|
||||
|
||||
var shortName = platformConfig.shortName && platformConfig.shortName();
|
||||
if (shortName && shortName != name) {
|
||||
strings.find('string[@name="launcher_name"]').text = shortName.replace(/\'/g, '\\\'');
|
||||
}
|
||||
|
||||
fs.writeFileSync(locations.strings, strings.write({indent: 4}), 'utf-8');
|
||||
events.emit('verbose', 'Wrote out android application name "' + name + '" to ' + locations.strings);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user