Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

noDesktopShortcut property for when MSI installs #146

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 7 additions & 0 deletions src/creator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ export interface MSICreatorOptions {
rebootMode?: string;
installLevel?: number;
bundled?: boolean;
noDesktopShortcut?: boolean;
}

export interface UIOptions {
Expand Down Expand Up @@ -101,6 +102,8 @@ export class MSICreator {
public wixTemplate = getTemplate('wix');
public uiTemplate = getTemplate('ui', true);
public wixVariableTemplate = getTemplate('wix-variable', true);
public addDesktopTemplate = getTemplate('add-desktop-shortcut', true);
public addDesktopFeatureTemplate = getTemplate('add-desktop-shortcut-feature', true);
public updaterTemplate = getTemplate('updater-feature', true);
public updaterPermissions = getTemplate('updater-permissions');
public autoLaunchTemplate = getTemplate('auto-launch-feature', true);
Expand Down Expand Up @@ -143,6 +146,7 @@ export class MSICreator {
public rebootMode: string;
public installLevel: number;
public bundled: boolean;
public noDesktopShortcut?: boolean;

public ui: UIOptions | boolean;

Expand Down Expand Up @@ -182,6 +186,7 @@ export class MSICreator {
this.rebootMode = options.rebootMode || 'ReallySuppress';
this.installLevel = options.installLevel || 2;
this.bundled = options.bundled || false;
this.noDesktopShortcut = options.noDesktopShortcut || false;

this.appUserModelId = options.appUserModelId
|| `com.squirrel.${this.shortName}.${this.exe}`.toLowerCase();
Expand Down Expand Up @@ -288,6 +293,8 @@ export class MSICreator {
'<!-- {{Directories}} -->': directories,
'<!-- {{UI}} -->': this.getUI(),
'<!-- {{AutoUpdatePermissions}} -->': this.autoUpdate ? this.updaterPermissions : '{{remove newline}}',
'<!-- {{AddDesktopShortcut}} -->': this.noDesktopShortcut ? '{{remove newline}}' : this.addDesktopTemplate,
'<!-- {{AddDesktopShortcutFeature}} -->': this.noDesktopShortcut ? '{{remove newline}}' : this.addDesktopFeatureTemplate,
'<!-- {{AutoUpdateFeature}} -->': this.autoUpdate ? this.updaterTemplate : '{{remove newline}}',
'<!-- {{AutoLaunchFeature}} -->': this.autoLaunch ? this.autoLaunchTemplate : '{{remove newline}}',
'<!-- {{UpdaterComponentRefs}} -->': updaterComponentRefs.map(({ xml }) => xml).join('\n'),
Expand Down
1 change: 1 addition & 0 deletions static/add-desktop-shortcut-feature.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<ComponentRef Id="DesktopShortcut" />
15 changes: 15 additions & 0 deletions static/add-desktop-shortcut.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<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>
22 changes: 4 additions & 18 deletions static/wix.xml
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@
WorkingDirectory="APPLICATIONROOTDIRECTORY">
<!-- {{ShortcutProperties}} -->
</Shortcut>
<RemoveFolder Id="ApplicationProgramsFolder" On="uninstall"/>
<RemoveFolder Id="ApplicationProgramsFolder" On="uninstall"/>
<RegistryValue Root="HKCU"
Key="Software\Microsoft\{{ApplicationShortName}}"
Name="installed"
Expand All @@ -118,22 +118,8 @@
</Component>
</DirectoryRef>

<!-- 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 4: Add app desktop shortcut (unless if set not to) -->
<!-- {{AddDesktopShortcut}} -->

<!-- {{AutoUpdatePermissions}} -->

Expand All @@ -151,7 +137,7 @@
<Feature Id="MainApplication" Title="Main Application" Level="1" Description="The main components to run the applications." >
<!-- {{ComponentRefs}} -->
<ComponentRef Id="ApplicationShortcut" />
<ComponentRef Id="DesktopShortcut" />
<!-- {{AddDesktopShortcutFeature}} -->
<ComponentRef Id="PurgeOnUninstall" />
</Feature>
<!-- {{AutoLaunchFeature}} -->
Expand Down