1919
2020#define Hash " "
2121#define VersionFolder " v" + MyAppVersion
22+ #define AppFolder " Proton\VPN"
2223#define SourcePath GetEnv(" BUILD_PATH" )
2324#define IsBTISource SourcePath == " src/bin/win-x64/BTI/publish"
2425#if IsBTISource
@@ -104,6 +105,12 @@ Source: "..\{#SourcePath}\uk-UA\ProtonVPN.Translations.resources.dll"; DestDir:
104105Source : " ..\{#SourcePath}\tr-TR\ProtonVPN.Translations.resources.dll" ; DestDir : " {app} \{#VersionFolder}\tr-TR" ; Flags : signonce;
105106Source : " ..\{#SourcePath}\be-BY\ProtonVPN.Translations.resources.dll" ; DestDir : " {app} \{#VersionFolder}\be-BY" ; Flags : signonce;
106107Source : " ..\{#SourcePath}\ka-GE\ProtonVPN.Translations.resources.dll" ; DestDir : " {app} \{#VersionFolder}\ka-GE" ; Flags : signonce;
108+ Source : " ..\{#SourcePath}\el-GR\ProtonVPN.Translations.resources.dll" ; DestDir : " {app} \{#VersionFolder}\el-GR" ; Flags : signonce;
109+ Source : " ..\{#SourcePath}\fi-FI\ProtonVPN.Translations.resources.dll" ; DestDir : " {app} \{#VersionFolder}\fi-FI" ; Flags : signonce;
110+ Source : " ..\{#SourcePath}\ko-KR\ProtonVPN.Translations.resources.dll" ; DestDir : " {app} \{#VersionFolder}\ko-KR" ; Flags : signonce;
111+ Source : " ..\{#SourcePath}\zh-TW\ProtonVPN.Translations.resources.dll" ; DestDir : " {app} \{#VersionFolder}\zh-TW" ; Flags : signonce;
112+ Source : " ..\{#SourcePath}\sv-SE\ProtonVPN.Translations.resources.dll" ; DestDir : " {app} \{#VersionFolder}\sv-SE" ; Flags : signonce;
113+ Source : " ..\{#SourcePath}\ja-JP\ProtonVPN.Translations.resources.dll" ; DestDir : " {app} \{#VersionFolder}\ja-JP" ; Flags : signonce;
107114
108115Source : " ..\{#SourcePath}\Resources\*.dll" ; DestDir : " {app} \{#VersionFolder}\Resources" ; Flags : signonce;
109116Source : " ..\{#SourcePath}\Resources\*.exe" ; DestDir : " {app} \{#VersionFolder}\Resources" ; Flags : signonce;
@@ -133,7 +140,9 @@ Filename: "{app}\{#VersionFolder}\{#ProtonDriveDownloaderName}"; Parameters: "{c
133140[Languages]
134141Name : " en_US" ; MessagesFile : " compiler:Default.isl,Strings\Default.isl"
135142Name : " cs_CZ" ; MessagesFile : " compiler:Languages\Czech.isl,Strings\Czech.isl"
143+ Name : " ja_JP" ; MessagesFile : " compiler:Languages\Japanese.isl,Strings\Japanese.isl"
136144Name : " de_DE" ; MessagesFile : " compiler:Languages\German.isl,Strings\German.isl"
145+ Name : " fi_FI" ; MessagesFile : " compiler:Languages\Finnish.isl,Strings\Finnish.isl"
137146Name : " fr_FR" ; MessagesFile : " compiler:Languages\French.isl,Strings\French.isl"
138147Name : " nl_NL" ; MessagesFile : " compiler:Languages\Dutch.isl,Strings\Dutch.isl"
139148Name : " it_IT" ; MessagesFile : " compiler:Languages\Italian.isl,Strings\Italian.isl"
@@ -152,6 +161,7 @@ Type: filesandordirs; Name: "{app}\{#VersionFolder}\Resources"
152161
153162[Dirs]
154163Name : " {localappdata} \ProtonVPN\DiagnosticLogs"
164+ Name : " {commonappdata} \ProtonVPN\Updates" ; AfterInstall : SetFolderPermissions;
155165
156166[Code]
157167function InitLogger (logger: Longword): Integer;
@@ -169,6 +179,9 @@ external 'UninstallProduct@files:ProtonVPN.InstallActions.x86.dll cdecl delayloa
169179function IsProductInstalled (upgradeCode: String): Integer;
170180external ' IsProductInstalled@files:ProtonVPN.InstallActions.x86.dll cdecl delayload' ;
171181
182+ function SetUpdatesFolderPermission (updatesFolderPath: String): Integer;
183+ external ' SetUpdatesFolderPermission@files:ProtonVPN.InstallActions.x86.dll cdecl delayload' ;
184+
172185function UninstallTapAdapter (tapFilesPath: String): Integer;
173186external ' [email protected] cdecl delayload uninstallonly' ;174187
@@ -231,25 +244,34 @@ begin
231244 end ;
232245end ;
233246
247+ procedure SetFolderPermissions ();
248+ begin
249+ SetUpdatesFolderPermission(ExpandConstant(' {commonappdata}\ProtonVPN\Updates' ));
250+ end ;
251+
234252procedure DeleteNonRunningVersions (const Directory: string);
235253var
236254 VersionFolder: TFindRec;
237- VersionFolderPath: String;
255+ VersionFolderPath, ProcessPath : String;
238256 i: Integer;
239257 Processes: array of String;
240258 IsRunningProcessFound: Boolean;
241259begin
260+ Log(' Using directory ' + Directory + ' to find previous app versions for deletion' );
242261 Processes := [' ProtonVPN.exe' , ' ProtonVPNService.exe' , ' ProtonVPN.WireGuardService.exe' ];
243262 if FindFirst(ExpandConstant(Directory + ' \v*' ), VersionFolder) then
244263 try
245264 repeat
265+ Log(' Found version folder ' + VersionFolder.Name );
246266 VersionFolderPath := AddBackslash(Directory) + AddBackslash(VersionFolder.Name )
247267 IsRunningProcessFound := False;
248268 for i := 0 to GetArrayLength(Processes) - 1 do
249269 begin
250- if IsProcessRunningByPath(VersionFolderPath + Processes[i]) then
270+ ProcessPath := VersionFolderPath + Processes[i];
271+ Log(' Checking if the process ' + ProcessPath + ' is running' );
272+ if IsProcessRunningByPath(ProcessPath) then
251273 begin
252- Log(' Running process detected: ' + VersionFolderPath + Processes[i] );
274+ Log(' Running process detected: ' + ProcessPath );
253275 IsRunningProcessFound := True;
254276 Break;
255277 end ;
@@ -382,13 +404,24 @@ begin
382404 Log(' Service uninstall returned: ' + IntToStr(Result));
383405end ;
384406
407+ function IsUpgrade : Boolean;
408+ begin
409+ Result := FileExists(ExpandConstant(' {app}\{#LauncherExeName}' ));
410+ end ;
411+
385412function PrepareToInstall (var NeedsRestart: Boolean): String;
413+ var
414+ vpnFolderPath: String;
386415begin
387- DeleteNonRunningVersions(ExpandConstant(' {app}' ));
416+ vpnFolderPath := ' {app}' ;
417+ if IsUpgrade = False then
418+ vpnFolderPath := vpnFolderPath + ' \{#AppFolder}' ;
419+
420+ DeleteNonRunningVersions(ExpandConstant(vpnFolderPath));
388421 Log(' Trying to save user settings for the old ProtonVPN app if it is installed' );
389422 SaveOldUserConfigFolder();
390423 Log(' Trying to update taskbar icon path if exists' );
391- UpdateTaskbarIconTarget(ExpandConstant(' {app} \{#VersionFolder}\{#MyAppExeName}' ));
424+ UpdateTaskbarIconTarget(ExpandConstant(vpnFolderPath + ' \{#VersionFolder}\{#MyAppExeName}' ));
392425 Log(' Trying to uninstall an old version of ProtonVPN app' );
393426 UninstallProduct(' {2B10124D-2F81-4BB1-9165-4F9B1B1BA0F9}' );
394427 Log(' Trying to uninstall an old version of ProtonVPN TUN adapter' );
@@ -458,19 +491,14 @@ var
458491 path: String;
459492begin
460493 path := WizardForm.DirEdit.Text;
461- StringChangeEx(path, ' \Proton\VPN ' , ' \Proton\Drive' , True);
494+ StringChangeEx(path, ExpandConstant( ' \{#AppFolder} ' ) , ' \Proton\Drive' , True);
462495 Result := ' "' + path + ' "' ;
463496end ;
464497
465- function IsUpgrade : Boolean;
466- begin
467- Result := FileExists(ExpandConstant(' {app}\{#LauncherExeName}' ));
468- end ;
469-
470498procedure CurPageChanged (CurPageID: Integer);
471499begin
472500 if (CurPageID = wpPreparing) and (IsInstallPathModified = False) and (IsUpgrade = False) then begin
473501 IsInstallPathModified := true;
474- WizardForm.DirEdit.Text := WizardForm.DirEdit.Text + ' \Proton\VPN ' ;
502+ WizardForm.DirEdit.Text := WizardForm.DirEdit.Text + ExpandConstant( ' \{#AppFolder} ' ) ;
475503 end ;
476504end ;
0 commit comments