Skip to content

Commit c8d7005

Browse files
authored
Merge pull request #329 from EasyG0ing1/windowsIcon
Added ability to name the shortcut created during Windows app install.
2 parents e7f281f + 8336264 commit c8d7005

File tree

4 files changed

+17
-5
lines changed

4 files changed

+17
-5
lines changed

build.gradle

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -209,4 +209,3 @@ task updateWhyJavaLauncher(type : Download) {
209209
dest file('src/main/resources/windows')
210210
overwrite true
211211
}
212-

docs/windows-specific-properties.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
<copyright>${organizationName}</copyright>
2222
<productName>${name}</productName>
2323
<internalName>${name}</internalName>
24+
<txtShortcutName>${name}</txtShortcutName>
2425
<originalFilename>${name}.exe</originalFilename>
2526

2627
<!-- choose EXE creation tool -->
@@ -77,7 +78,7 @@
7778
## Exe creation properties
7879

7980
| Property | Mandatory | Default value | Description |
80-
| ------------------- | --------- | --------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------- |
81+
|---------------------| --------- |-----------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------|
8182
| `headerType` | :x: | `"gui"` | EXE header type: `console` or `gui`. |
8283
| `wrapJar` | :x: | `true` | Wrap JAR file in native EXE. |
8384
| `companyName` | :x: | `${organizationName}` | EXE company name. |
@@ -100,9 +101,10 @@
100101
## Setup generation properties
101102

102103
| Property | Mandatory | Default value | Description |
103-
| ------------------------- | --------- | ------------------------------------------------------------------------------------------ | ---------------------------------------------------------------------------------------------- |
104+
|---------------------------| --------- |--------------------------------------------------------------------------------------------|------------------------------------------------------------------------------------------------|
104105
| `setupMode` | :x: | `installForAllUsers` | Setup installation mode: require administrative privileges or not. [*](#setupmode) |
105106
| `setupLanguages` | :x: | `<english>compiler:Default.isl</english><spanish>compiler:Languages\Spanish.isl</spanish>` | Map with setup languages. |
107+
| `txtShortcutName` | :x: | `${name}` | Sets the name of the user optional shortcut created on the desktop |
106108
| `disableDirPage` | :x: | `true` | If this is set to `true`, Setup will not show the **Select Destination Location** wizard page. |
107109
| `disableProgramGroupPage` | :x: | `true` | If this is set to `true`, Setup will not show the **Select Start Menu Folder** wizard page. |
108110
| `disableFinishedPage` | :x: | `true` | If this is set to `true`, Setup will not show the **Setup Completed** wizard page. |

src/main/java/io/github/fvarrui/javapackager/model/WindowsConfig.java

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ public class WindowsConfig implements Serializable {
3030
private String trademarks;
3131
private String txtFileVersion;
3232
private String txtProductVersion;
33+
private String txtShortcutName;
3334
private boolean disableDirPage = true;
3435
private boolean disableProgramGroupPage = true;
3536
private boolean disableFinishedPage = true;
@@ -153,6 +154,14 @@ public void setTxtProductVersion(String txtProductVersion) {
153154
this.txtProductVersion = txtProductVersion;
154155
}
155156

157+
public String getTxtShortcutName() {
158+
return txtShortcutName;
159+
}
160+
161+
public void setTxtShortcutName(String txtShortcutName) {
162+
this.txtShortcutName = txtShortcutName;
163+
}
164+
156165
public String getInternalName() {
157166
return internalName;
158167
}
@@ -312,6 +321,7 @@ public String toString() {
312321
+ ", internalName=" + internalName + ", language=" + language + ", originalFilename=" + originalFilename
313322
+ ", productName=" + productName + ", productVersion=" + productVersion + ", trademarks=" + trademarks
314323
+ ", txtFileVersion=" + txtFileVersion + ", txtProductVersion=" + txtProductVersion
324+
+ ", txtShortcutName=" + txtShortcutName
315325
+ ", disableDirPage=" + disableDirPage + ", disableProgramGroupPage=" + disableProgramGroupPage
316326
+ ", disableFinishedPage=" + disableFinishedPage + ", disableRunAfterInstall=" + disableRunAfterInstall
317327
+ ", disableWelcomePage=" + disableWelcomePage + ", createDesktopIconTask=" + createDesktopIconTask
@@ -331,6 +341,7 @@ public void setDefaults(Packager packager) {
331341
this.setFileVersion(defaultIfBlank(this.getFileVersion(), "1.0.0.0"));
332342
this.setTxtFileVersion(defaultIfBlank(this.getTxtFileVersion(), "" + packager.getVersion()));
333343
this.setProductVersion(defaultIfBlank(this.getProductVersion(), "1.0.0.0"));
344+
this.setTxtShortcutName(defaultIfBlank(this.getTxtShortcutName(), packager.getName()));
334345
this.setTxtProductVersion(defaultIfBlank(this.getTxtProductVersion(), "" + packager.getVersion()));
335346
this.setCompanyName(defaultIfBlank(this.getCompanyName(), packager.getOrganizationName()));
336347
this.setCopyright(defaultIfBlank(this.getCopyright(), packager.getOrganizationName()));
@@ -340,5 +351,4 @@ public void setDefaults(Packager packager) {
340351
this.setOriginalFilename(defaultIfBlank(this.getOriginalFilename(), packager.getName() + ".exe"));
341352
this.setMsiUpgradeCode(defaultIfBlank(this.getMsiUpgradeCode(), UUID.randomUUID().toString()));
342353
}
343-
344354
}

src/main/resources/windows/iss.vtl

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
\#define MyAppFolder "${info.name}"
77
\#define MyAppLicense "$!{info.licenseFile.absolutePath}"
88
\#define MyAppIcon "${info.iconFile.absolutePath}"
9+
\#define MyShortcutName = "${info.winConfig.txtShortcutName}"
910

1011
[Setup]
1112
AppId={{{#MyAppName}}}
@@ -85,7 +86,7 @@ Source: "${info.appFolder}\*"; DestDir: "{app}"; Flags: ignoreversion recursesub
8586
[Icons]
8687
Name: "{autoprograms}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"; IconFilename: "{app}\\${info.iconFile.name}"
8788
#if ($info.winConfig.createDesktopIconTask)
88-
Name: "{autodesktop}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"; IconFilename: "{app}\\${info.iconFile.name}"; Tasks: desktopicon
89+
Name: "{autodesktop}\{#MyShortcutName}"; Filename: "{app}\{#MyAppExeName}"; IconFilename: "{app}\\${info.iconFile.name}"; Tasks: desktopicon
8990
#end
9091

9192
[Run]

0 commit comments

Comments
 (0)