Skip to content

Commit 793ef1e

Browse files
committed
Modifying templates
1 parent e357609 commit 793ef1e

File tree

2 files changed

+24
-21
lines changed

2 files changed

+24
-21
lines changed

gui/packaging/config/config.xml.template

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,14 @@
55
<Title>{{ progname }} Installer</Title>
66
<Publisher>{{ publisher }}</Publisher>
77
<StartMenuDir>{{ publisher }}</StartMenuDir>
8-
<TargetDir>@HomeDir@/{{ publisher }}/{{ progfolder }}</TargetDir>
9-
<RunProgram>@TargetDir@/{{ executable }}/</RunProgram>
8+
9+
<!-- Fixed install location (no version folder) -->
10+
<TargetDir>@ApplicationsDir@/{{ publisher }}/{{ progfolder }}</TargetDir>
11+
12+
<!-- Launch main executable after install -->
13+
<RunProgram>{{ executable }}.exe</RunProgram>
1014
<RunProgramDescription>{{ progdescription }}</RunProgramDescription>
15+
16+
<!-- Installer window icon -->
1117
<InstallerApplicationIcon>{{ iconfilename }}</InstallerApplicationIcon>
1218
</Installer>
Lines changed: 16 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,39 +1,36 @@
11
function Component()
22
{
3-
// default constructor
4-
component.forceInstallation = true;
3+
component.forceInstallation = true; // Ensures component installs even if already present
54
}
65

76
Component.prototype.createOperations = function()
87
{
98
component.createOperations();
109

11-
// Remove old executable if it exists (optional cleanup)
12-
var oldExe = "@TargetDir@/{{ executable }}.exe"
13-
if (QFile.exists(oldExe)) {
14-
installer.performOperation("Delete", oldExe);
15-
}
10+
var exePath = installer.value("TargetDir") + "/{{ executable }}.exe";
11+
var shortcutPath = installer.value("StartMenuDir") + "/{{ executable }}.lnk";
1612

17-
// Remove old shortcut if it exists (optional cleanup)
18-
var oldShortcut = "@StartMenuDir@/{{ executable }}.lnk";
19-
if (QFile.exists(oldShortcut)) {
20-
installer.performOperation("Delete", oldShortcut);
13+
// Clean up old shortcut (QtIF doesn't remove shortcuts if renamed/moved)
14+
if (installer.fileExists(shortcutPath)) {
15+
installer.performOperation("Delete", shortcutPath);
2116
}
2217

23-
// Windows-specific shortcut creation
18+
// Create Start Menu shortcut (Windows only)
2419
if (systemInfo.productType === "windows") {
25-
component.addOperation("CreateShortcut", "@TargetDir@/{{ executable }}.exe",
26-
"@StartMenuDir@/{{ executable }}.lnk",
27-
"workingDirectory=@TargetDir@",
28-
"iconPath=@TargetDir@/{{ iconfilename }}",
29-
"description=Open {{ progname }}");
20+
component.addOperation("CreateShortcut",
21+
"@TargetDir@/{{ executable }}.exe",
22+
"@StartMenuDir@/{{ executable }}.lnk",
23+
"workingDirectory=@TargetDir@",
24+
"iconPath=@TargetDir@/{{ iconfilename }}",
25+
"description=Open {{ progname }}"
26+
);
3027
}
3128

32-
// Optional: Run the application after install
29+
// Optional: launch the application after install
3330
component.addOperation("Execute",
3431
"@TargetDir@/{{ executable }}.exe",
3532
"",
3633
"UNDOEXECUTE",
3734
"@TargetDir@/{{ executable }}.exe"
3835
);
39-
}
36+
}

0 commit comments

Comments
 (0)