diff --git a/before_plugin_install.js b/before_plugin_install.js new file mode 100644 index 00000000..d29efa58 --- /dev/null +++ b/before_plugin_install.js @@ -0,0 +1,35 @@ +var fs = require("fs"); +var path = require("path"); +var rootdir = process.env.PWD; +var valuesPath = "/platforms/android/app/src/main/res/values/"; +var themesFile = "themes.xml"; +var destFile = path.join(rootdir, valuesPath, themesFile); +var destDir = path.dirname(destFile); + +module.exports = function (context) { + console.log("*************************************"); + console.log(`before_plugin_install running`); + console.log("*************************************"); + + if (fs.existsSync(destDir)) { + if (!fs.existsSync(destFile)) { + console.log("*************************************"); + console.log(`creating new ${destFile}`); + console.log("*************************************"); + fs.writeFile( + destFile, + '\n\n\n', + function (err) { + if (err) { + console.error("writeFile error" + err); + } + console.log(`${themesFile} created!`); + } + ); + } else { + console.log(`skipping, file ${themesFile} exists`); + } + } else { + console.log("skipping, android platform not found"); + } +}; \ No newline at end of file diff --git a/plugin.xml b/plugin.xml index e6f5a2c7..29893121 100644 --- a/plugin.xml +++ b/plugin.xml @@ -92,6 +92,11 @@ + + + + + @@ -136,7 +141,7 @@ - +