diff --git a/tools/install/win/lazarus.def.isl b/tools/install/win/lazarus.def.isl index df39297373..1b70bea0c9 100644 --- a/tools/install/win/lazarus.def.isl +++ b/tools/install/win/lazarus.def.isl @@ -20,6 +20,7 @@ FolderNotEmpty2=The target folder is not empty. FolderForSecondNoFile=The target folder is not empty and does not contains an upgradable secondary Lazarus installation.%0:sPlease choose an empty folder, or an folder with an existing secondary Lazarus installation for updating. FolderForSecondBadFile=The target folder is not empty. The installer could not detect if it contains an upgradable secondary Lazarus installation%0:sPlease choose an empty folder, or an folder with an existing secondary Lazarus installation for updating. FolderForSecondUpgrading=The target folder is not empty.%0:sIt contains a secondary Lazarus installation using the following folder for configuration:%0:s%1:s%0:s%0:sContinue with installation? +FolderForSecondUpgradingPrimary=The target folder is not empty.%0:sIt contains a default (none secondary) Lazarus installation%0:sIf you continue, it will be changed into a secondary installation%0:s%0:s%0:sContinue with installation? FolderForSecondBadUninstall=The target folder is not empty. The installer could not verify if it is safe to use.%0:sPlease choose an empty folder, or an folder with an existing secondary Lazarus installation for updating. diff --git a/tools/install/win/lazarus.iss b/tools/install/win/lazarus.iss index efec29a3e7..884d13f1f8 100644 --- a/tools/install/win/lazarus.iss +++ b/tools/install/win/lazarus.iss @@ -303,6 +303,29 @@ var UninstDir: String; CFGFileForUninstDir: TStringList; +function GetDefDir( def: String ) : String; +begin + if Pos( ' ', def ) > 0 then + begin + def := Copy( def, 1, Pos( ' ', def ) - 1 ) + '\NoFolderSpace'; + end; + Result := def; +end; + +procedure UpdateEnvironmentOptions(); +var + FileName, Content: string; + s: Ansistring; +begin + FileName := ExpandConstant(CurrentFileName); + LoadStringFromFile(FileName, s); + Content := s; + StringChange(Content, '%Temp%', GetTempDir); + StringChange(Content, '%LazDir%', ExpandConstant('{app}')); + StringChange(Content, '%FpcBinDir%', ExpandConstant('{app}\fpc\{#FPCVersion}\bin\{#FPCFullTarget}\')); + SaveStringToFile(FileName, Content, False); +end; + function GetAppId(param:string): String; var s: String; @@ -512,6 +535,13 @@ begin CheckSecondLabel.Height := WizardForm.DirEdit.Parent.Height - CheckSecondLabel.Top - 15; CheckSecondLabel.Caption := CustomMessage('CheckSecondInfo'); end; + + if CurPage = wpInfoAfter then begin + if (CheckSecondInstall <> nil) and (CheckSecondInstall.Checked) then begin + if (NewCFGFile = nil) or (not FileExists(AddBackslash(WizardDirValue) + 'lazarus.cfg')) then + MsgBox('Something went wrong. The secondary config folder was not setup. Repeat the installation.', mbConfirmation, MB_OK); + end; + end; end; function NextButtonClick(CurPage: Integer): Boolean; @@ -610,12 +640,6 @@ begin CreateCFGFile(SecondPCP, NewCFGFile); end; - if CurPage = wpInfoAfter then begin - if (CheckSecondInstall <> nil) and (CheckSecondInstall.Checked) then begin - if (NewCFGFile = nil) or (not FileExists(AddBackslash(WizardDirValue) + 'lazarus.cfg')) then - MsgBox('Something went wrong. The secondary config folder was not setup. Repeat the installation.', mbConfirmation, MB_OK); - end; - end; end; function ShouldSkipPage(PageId: Integer): Boolean; @@ -697,49 +721,6 @@ begin end; end; -function GetDefDir( def: String ) : String; -begin - if Pos( ' ', def ) > 0 then - begin - def := Copy( def, 1, Pos( ' ', def ) - 1 ) + '\NoFolderSpace'; - end; - Result := def; -end; - -procedure UpdateEnvironmentOptions(); -var - FileName, Content: string; - s: Ansistring; -begin - FileName := ExpandConstant(CurrentFileName); - LoadStringFromFile(FileName, s); - Content := s; - StringChange(Content, '%Temp%', GetTempDir); - StringChange(Content, '%LazDir%', ExpandConstant('{app}')); - StringChange(Content, '%FpcBinDir%', ExpandConstant('{app}\fpc\{#FPCVersion}\bin\{#FPCFullTarget}\')); - SaveStringToFile(FileName, Content, False); -end; - -function IsHKLMWriteable(): boolean; -begin - Result := IsAdminLoggedOn or IsPowerUserLoggedOn; -end; - -function IsHKLMNotWriteable: boolean; -begin - Result := not IsHKLMWriteable(); -end; - -function GetAssociateDesc(const ext: string): string; -var - AmpersandPos: integer; -begin - Result := FmtMessage(CustomMessage('AssocFileExtension'), ['Lazarus',ext]); - AmpersandPos := pos('&', Result); - if AmpersandPos>0 then - Delete(Result, AmpersandPos, 1); -end; - procedure InitAskUninstall(s1, s2, s3, s4: String); var y: integer; @@ -996,6 +977,26 @@ begin end; +function IsHKLMWriteable(): boolean; +begin + Result := IsAdminLoggedOn or IsPowerUserLoggedOn; +end; + +function IsHKLMNotWriteable: boolean; +begin + Result := not IsHKLMWriteable(); +end; + +function GetAssociateDesc(const ext: string): string; +var + AmpersandPos: integer; +begin + Result := FmtMessage(CustomMessage('AssocFileExtension'), ['Lazarus',ext]); + AmpersandPos := pos('&', Result); + if AmpersandPos>0 then + Delete(Result, AmpersandPos, 1); +end; + //function InitializeUninstall(): Boolean; //var i: integer; //begin