From ef4f212fc1482136dba1e690ec589b315b4a377f Mon Sep 17 00:00:00 2001 From: Jules Laplace Date: Tue, 8 Nov 2016 12:37:03 -0500 Subject: build 0.7.0 --- .../src/windows/hooks/prepare-manifest.js | 30 ++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 StoneIsland/plugins/cordova-plugin-customurlscheme/src/windows/hooks/prepare-manifest.js (limited to 'StoneIsland/plugins/cordova-plugin-customurlscheme/src/windows/hooks') diff --git a/StoneIsland/plugins/cordova-plugin-customurlscheme/src/windows/hooks/prepare-manifest.js b/StoneIsland/plugins/cordova-plugin-customurlscheme/src/windows/hooks/prepare-manifest.js new file mode 100644 index 00000000..06e237f7 --- /dev/null +++ b/StoneIsland/plugins/cordova-plugin-customurlscheme/src/windows/hooks/prepare-manifest.js @@ -0,0 +1,30 @@ +module.exports = function(context) { + var fs = context.requireCordovaModule('fs'), + et = context.requireCordovaModule('elementtree'), + path = context.requireCordovaModule('path'), + xml= context.requireCordovaModule('cordova-common').xmlHelpers, + projectRoot = path.join(context.opts.projectRoot, "platforms", "windows"); + + var MANIFEST_WINDOWS = 'package.windows.appxmanifest', + MANIFEST_PHONE = 'package.phone.appxmanifest', + MANIFEST_WINDOWS10 = 'package.windows10.appxmanifest', + MANIFEST_WINDOWS80 = 'package.windows80.appxmanifest'; + + function updateManifestFile(manifestPath) { + var doc = xml.parseElementtreeSync(manifestPath); + var root = doc.getroot(); + var app = root.find('./Applications/Application'); + if (!app) { + throw new Error(manifestPath + ' has incorrect XML structure.'); + } + if (!app.find('./Extensions')) { + app.append(new et.Element('Extensions')); + } + fs.writeFileSync(manifestPath, doc.write({indent: 4}), 'utf-8'); + } + + [MANIFEST_PHONE, MANIFEST_WINDOWS80, MANIFEST_WINDOWS, MANIFEST_WINDOWS10] + .forEach(function(manifestFile) { + updateManifestFile(path.join(projectRoot, manifestFile)); + }); +} -- cgit v1.2.3-70-g09d2