Skip to content

Commit ae9e3e8

Browse files
added Inno Setup
1 parent 4e17404 commit ae9e3e8

3 files changed

Lines changed: 47 additions & 26 deletions

File tree

.github/workflows/release.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ jobs:
6565
6666
- name: Debugging - Print changed files
6767
run: |
68-
echo "Changed files: $CHANGED_FILES"
68+
echo "Changed files: $CHANGED_FILES"
6969
7070
- name: Create and push tag (if it doesn't exist and files have changed)
7171
if: env.TAG_EXISTS == 'false' && env.FILES_CHANGED == 'true'

CalibreImport/InnoSetup/CalibreImportSetup.iss

Lines changed: 46 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,37 @@
1+
#define AppDll "CalibreImport.dll"
2+
#define ConfigFile "CalibreImport.config"
3+
#define ReleaseFilesPath "..\ReleaseFiles\"
4+
15
[Setup]
26
AppName=YourAppName
37
AppVersion=1.0
48
DefaultDirName={pf}\CalibreImport
59
DefaultGroupName=Calibre Import Shell Extension
610
UninstallDisplayIcon={app}\YourApp.exe
7-
OutputDir=..\ReleaseFiles
11+
OutputDir={#ReleaseFilesPath}
812
OutputBaseFilename=CalibreImportSetup
913
Compression=lzma
1014
SolidCompression=yes
1115

1216
[Files]
13-
Source: "..\ReleaseFiles\CalibreImport.dll"; DestDir: "{app}"; Flags: ignoreversion
14-
Source: "..\ReleaseFiles\CalibreImport.config"; DestDir: "{userappdata}\YourAppName"; Flags: ignoreversion
17+
Source: "{#ReleaseFilesPath}{#AppDll}"; DestDir: "{app}"; Flags: ignoreversion
18+
Source: "{#ReleaseFilesPath}{#ConfigFile}"; DestDir: "{userappdata}\YourAppName"; Flags: ignoreversion
1519

1620
[Icons]
1721
Name: "{group}\YourAppName"; Filename: "{app}\YourApp.exe"
1822

1923
[Code]
24+
const
25+
AppDll = '{#AppDll}'; // Use preprocessor variable
26+
ConfigFile = '{#ConfigFile}'; // Use preprocessor variable
27+
ReleaseFilesPath = '{#ReleaseFilesPath}'; // Use preprocessor variable
28+
2029
var
2130
PortableMode: Boolean;
2231
RestartExplorer: Boolean;
2332
InstallPath: String;
33+
PortableModeCheck: TNewCheckBox;
34+
RestartExplorerCheck: TNewCheckBox;
2435
2536
function IsDotNet48Installed: Boolean;
2637
var
@@ -48,45 +59,55 @@ begin
4859
{ Initialize variables }
4960
PortableMode := False;
5061
RestartExplorer := False;
62+
63+
{ Initialize InstallPath with a default directory }
64+
InstallPath := ExpandConstant('{sd}'); // Default to the system drive (e.g., C:\)
5165
5266
{ Create a checkbox for portable mode }
53-
WizardForm.PortableModeCheck := TNewCheckBox.Create(WizardForm);
54-
WizardForm.PortableModeCheck.Parent := WizardForm.SelectDirPage;
55-
WizardForm.PortableModeCheck.Left := WizardForm.SelectDirLabel.Left;
56-
WizardForm.PortableModeCheck.Top := WizardForm.SelectDirEdit.Top + WizardForm.SelectDirEdit.Height + 10;
57-
WizardForm.PortableModeCheck.Width := WizardForm.SelectDirLabel.Width;
58-
WizardForm.PortableModeCheck.Caption := 'Install in portable mode';
59-
WizardForm.PortableModeCheck.Checked := PortableMode;
67+
PortableModeCheck := TNewCheckBox.Create(WizardForm);
68+
PortableModeCheck.Parent := WizardForm.SelectDirPage;
69+
PortableModeCheck.Left := WizardForm.DirEdit.Left; // Use DirEdit instead of SelectDirLabel
70+
PortableModeCheck.Top := WizardForm.DirEdit.Top + WizardForm.DirEdit.Height + 10;
71+
PortableModeCheck.Width := WizardForm.DirEdit.Width; // Use DirEdit instead of SelectDirLabel
72+
PortableModeCheck.Caption := 'Install in portable mode';
73+
PortableModeCheck.Checked := PortableMode;
6074
6175
{ Create a checkbox for restarting Explorer }
62-
WizardForm.RestartExplorerCheck := TNewCheckBox.Create(WizardForm);
63-
WizardForm.RestartExplorerCheck.Parent := WizardForm.FinishedPage;
64-
WizardForm.RestartExplorerCheck.Left := WizardForm.FinishedLabel.Left;
65-
WizardForm.RestartExplorerCheck.Top := WizardForm.FinishedLabel.Top + WizardForm.FinishedLabel.Height + 10;
66-
WizardForm.RestartExplorerCheck.Width := WizardForm.FinishedLabel.Width;
67-
WizardForm.RestartExplorerCheck.Caption := 'Restart Windows Explorer after installation';
68-
WizardForm.RestartExplorerCheck.Checked := RestartExplorer;
76+
RestartExplorerCheck := TNewCheckBox.Create(WizardForm);
77+
RestartExplorerCheck.Parent := WizardForm.FinishedPage;
78+
RestartExplorerCheck.Left := WizardForm.FinishedLabel.Left;
79+
RestartExplorerCheck.Top := WizardForm.FinishedLabel.Top + WizardForm.FinishedLabel.Height + 10;
80+
RestartExplorerCheck.Width := WizardForm.FinishedLabel.Width;
81+
RestartExplorerCheck.Caption := 'Restart Windows Explorer after installation';
82+
RestartExplorerCheck.Checked := RestartExplorer;
6983
end;
7084
7185
procedure CurStepChanged(CurStep: TSetupStep);
86+
var
87+
SourceAppDll, SourceConfigFile: String;
88+
ResultCode: Integer; // Declare ResultCode variable
7289
begin
7390
if CurStep = ssPostInstall then
7491
begin
92+
{ Resolve the full paths to the source files }
93+
SourceAppDll := ExpandConstant('{src}\' + ReleaseFilesPath + AppDll);
94+
SourceConfigFile := ExpandConstant('{src}\' + ReleaseFilesPath + ConfigFile);
95+
7596
if PortableMode then
7697
begin
7798
{ Copy files to the selected folder }
78-
FileCopy(ExpandConstant('{app}\YourApp.dll'), InstallPath + '\YourApp.dll', False);
79-
FileCopy(ExpandConstant('{app}\YourSettingsFile.ini'), InstallPath + '\YourSettingsFile.ini', False);
99+
FileCopy(SourceAppDll, InstallPath + '\' + AppDll, False);
100+
FileCopy(SourceConfigFile, InstallPath + '\' + ConfigFile, False);
80101
end
81102
else
82103
begin
83104
{ Copy files to Program Files and AppData }
84-
FileCopy(ExpandConstant('{app}\YourApp.dll'), ExpandConstant('{pf}\YourAppName\YourApp.dll'), False);
85-
FileCopy(ExpandConstant('{app}\YourSettingsFile.ini'), ExpandConstant('{userappdata}\YourAppName\YourSettingsFile.ini'), False);
105+
FileCopy(SourceAppDll, ExpandConstant('{pf}\YourAppName\' + AppDll), False);
106+
FileCopy(SourceConfigFile, ExpandConstant('{userappdata}\YourAppName\' + ConfigFile), False);
86107
end;
87108
88109
{ Register the DLL using regasm }
89-
Exec(ExpandConstant('{win}\Microsoft.NET\Framework\v4.0.30319\regasm.exe'), ExpandConstant('"{app}\YourApp.dll" /codebase'), '', SW_HIDE, ewWaitUntilTerminated, ResultCode);
110+
Exec(ExpandConstant('{win}\Microsoft.NET\Framework\v4.0.30319\regasm.exe'), ExpandConstant('"{app}\' + AppDll + '" /codebase'), '', SW_HIDE, ewWaitUntilTerminated, ResultCode);
90111
91112
if RestartExplorer then
92113
begin
@@ -101,18 +122,18 @@ procedure CurPageChanged(CurPageID: Integer);
101122
begin
102123
if CurPageID = wpSelectDir then
103124
begin
104-
PortableMode := WizardForm.PortableModeCheck.Checked;
125+
PortableMode := PortableModeCheck.Checked;
105126
if PortableMode then
106127
begin
107128
{ Show folder picker for portable mode }
108-
if BrowseForFolder('Select the folder for portable installation', '', InstallPath) then
129+
iif BrowseForFolder('Select the folder for portable installation', InstallPath, True) then
109130
begin
110131
WizardForm.DirEdit.Text := InstallPath;
111132
end;
112133
end;
113134
end
114135
else if CurPageID = wpFinished then
115136
begin
116-
RestartExplorer := WizardForm.RestartExplorerCheck.Checked;
137+
RestartExplorer := RestartExplorerCheck.Checked;
117138
end;
118139
end;
2.14 MB
Binary file not shown.

0 commit comments

Comments
 (0)