Skip to content

Commit

Permalink
Merge pull request #60 from kokulansk/desktop-shortcut
Browse files Browse the repository at this point in the history
Desktop shortcut implementation
  • Loading branch information
felixrieseberg committed Feb 20, 2020
2 parents b8ce356 + 70fcb44 commit 3a1bcc6
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 2 deletions.
2 changes: 1 addition & 1 deletion __tests__/mocks/mock-fs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import * as path from 'path';

export const drive = process.platform === 'win32' ? 'C:' : '/';
export const root = path.join(drive, 'Users', 'tester', 'Code', 'app');
export const numberOfFiles = 14;
export const numberOfFiles = 15;

const staticDir = path.join(__dirname, '../../static');
const staticContent: Record<string, Record<string, any>> = {};
Expand Down
1 change: 1 addition & 0 deletions src/creator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,7 @@ export class MSICreator {
'{{ProgramFilesFolder}}': this.arch === 'x86' ? 'ProgramFilesFolder' : 'ProgramFiles64Folder',
'{{ProcessorArchitecture}}' : this.arch,
'{{Win64YesNo}}' : this.arch === 'x86' ? 'no' : 'yes',
'{{DesktopShortcutGuid}}': uuid()
};

const completeTemplate = replaceInString(this.wixTemplate, scaffoldReplacements);
Expand Down
24 changes: 23 additions & 1 deletion static/wix.xml
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,10 @@
<Directory Id="{{ProgramFilesFolder}}">
<!-- {{Directories}} -->
</Directory>

<!-- Desktop -->
<Directory Id="DesktopFolder" Name="Desktop" />

<!-- Start Menu -->
<Directory Id="ProgramMenuFolder">
<Directory Id="ApplicationProgramsFolder" Name="{{ShortcutFolderName}}"/>
Expand All @@ -72,10 +76,28 @@
</Component>
</DirectoryRef>

<!-- Step 4: Tell WiX to install the files -->
<!-- Step 4: Add app desktop shortcut -->
<DirectoryRef Id="DesktopFolder">
<Component Id="DesktopShortcut" Guid="{{DesktopShortcutGuid}}" >
<Shortcut Id="MyDesktopShortcut"
Name="{{ShortcutName}}"
Description="{{ApplicationDescription}}"
Target="[APPLICATIONROOTDIRECTORY]{{ApplicationBinary}}.exe"
WorkingDirectory="APPLICATIONROOTDIRECTORY"/>
<RegistryValue Root="HKCU"
Key="Software\Microsoft\{{ApplicationShortName}}"
Name="installed"
Type="integer"
Value="1"
KeyPath="yes" />
</Component>
</DirectoryRef>

<!-- Step 5: Tell WiX to install the files -->
<Feature Id="MainApplication" Title="Main Application" Level="1">
<!-- {{ComponentRefs}} -->
<ComponentRef Id="ApplicationShortcut" />
<ComponentRef Id="DesktopShortcut" />
</Feature>
</Product>
</Wix>

0 comments on commit 3a1bcc6

Please sign in to comment.