-
Notifications
You must be signed in to change notification settings - Fork 0
/
setup.iss
57 lines (48 loc) · 1.96 KB
/
setup.iss
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
[Setup]
; Basic information
AppName=Account Code Explorer
AppVersion=1.0.2
AppPublisher=Andrew Arneson
AppPublisherURL=https://www.github.com/Loran425
AppSupportURL=https://github.com/Loran425/AccountCodeExplorer/issues
AppUpdatesURL=http://www.github.com/Loran425/AccountCodeExplorer/releases
AppCopyright=Copyright © 2024 Andrew Arneson
DefaultDirName={localappdata}\Account Code Explorer
DefaultGroupName=Account Code Explorer
OutputDir=output
OutputBaseFilename=AccountCodeExplorerSetup
SetupIconFile=AccountCodeExplorer.ico
PrivilegesRequired=lowest
[Files]
; Include all files from the build directory
Source: "build\exe.win-amd64-3.12\*"; DestDir: "{app}"; Flags: ignoreversion recursesubdirs createallsubdirs
Source: "default_config.ini"; DestDir: "{app}"; Flags: ignoreversion
[Icons]
; Create shortcuts
Name: "{group}\Account Code Explorer"; Filename: "{app}\Account Code Explorer.exe"; WorkingDir: "{app}"
Name: "{group}\Uninstall Account Code Explorer"; Filename: "{uninstallexe}"
[Run]
; Run the application after installation
Filename: "{app}\Account Code Explorer.exe"; Description: "Launch Account Code Explorer"; Flags: nowait postinstall skipifsilent
[Code]
procedure CreateDefaultConfig;
var
AppDataPath: string;
ConfigFilePath: string;
begin
// Get the path to the Roaming AppData folder
AppDataPath := ExpandConstant('{userappdata}\Account Code Explorer');
// Ensure the directory exists
if not DirExists(AppDataPath) then
ForceDirectories(AppDataPath);
// Define the path for the default_config.ini file
ConfigFilePath := AppDataPath + '\default_config.ini';
// Copy the file from the installation directory to the Roaming AppData folder
if not FileCopy(ExpandConstant('{app}\default_config.ini'), ConfigFilePath, False) then
MsgBox('Failed to create default_config.ini in the Roaming AppData folder.', mbError, mb_OK);
end;
procedure CurStepChanged(CurStep: TSetupStep);
begin
if CurStep = ssPostInstall then
CreateDefaultConfig;
end;