Created
April 11, 2018 22:24
-
-
Save NQuinn27/4ae6d9fad4147cd5796f9fb8bab97c33 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env node | |
module.exports = function(context) { | |
var fs = context.requireCordovaModule('fs'), | |
path = context.requireCordovaModule('path'); | |
var platformRoot = path.join(context.opts.projectRoot, 'platforms/android'); | |
var manifestFile = path.join(platformRoot, 'AndroidManifest.xml'); | |
if (fs.existsSync(manifestFile)) { | |
fs.readFile(manifestFile, 'utf8', function (err,data) { | |
if (err) { | |
throw new Error('Unable to find AndroidManifest.xml: ' + err); | |
} | |
var appClass = 'com.popdeem.cordova.plugin.PopdeemApplication'; | |
if (data.indexOf(appClass) == -1) { | |
var result = data.replace(/<application/g, '<application android:name="' + appClass + '"'); | |
fs.writeFile(manifestFile, result, 'utf8', function (err) { | |
if (err) throw new Error('Unable to write into AndroidManifest.xml: ' + err); | |
}) | |
} | |
}); | |
} | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment