From b16a89014adcd01e492670c3976dcf105e77a284 Mon Sep 17 00:00:00 2001 From: Daniel Weck Date: Tue, 22 Oct 2019 19:10:14 +0100 Subject: [PATCH] feat(appx): added missing support for AppX fileAssociations (#4302) --- .../app-builder-lib/src/targets/AppxTarget.ts | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/packages/app-builder-lib/src/targets/AppxTarget.ts b/packages/app-builder-lib/src/targets/AppxTarget.ts index 51e970b4c90..68fa5752285 100644 --- a/packages/app-builder-lib/src/targets/AppxTarget.ts +++ b/packages/app-builder-lib/src/targets/AppxTarget.ts @@ -251,13 +251,16 @@ export default class AppXTarget extends Target { const uriSchemes = asArray(this.packager.config.protocols) .concat(asArray(this.packager.platformSpecificBuildOptions.protocols)) + const fileAssociations = asArray(this.packager.config.fileAssociations) + .concat(asArray(this.packager.platformSpecificBuildOptions.fileAssociations)) + let isAddAutoLaunchExtension = this.options.addAutoLaunchExtension if (isAddAutoLaunchExtension === undefined) { const deps = this.packager.info.metadata.dependencies isAddAutoLaunchExtension = deps != null && deps["electron-winstore-auto-launch"] != null } - if (!isAddAutoLaunchExtension && uriSchemes.length === 0) { + if (!isAddAutoLaunchExtension && uriSchemes.length === 0 && fileAssociations.length === 0) { return "" } @@ -281,6 +284,19 @@ export default class AppXTarget extends Target { } } + for (const fileAssociation of fileAssociations) { + for (const ext of asArray(fileAssociation.ext)) { + extensions += ` + + + + .${ext} + + + ` + } + } + extensions += "" return extensions }