瀏覽代碼

The /PORTABLE=1 command line parameter accepted by Inno Setup's own installers has been improved to allow side-by-side installations.

Martijn Laan 5 年之前
父節點
當前提交
8fc9d64694
共有 4 個文件被更改,包括 63 次插入15 次删除
  1. 7 1
      ISHelp/isetup.xml
  2. 37 0
      isportable.iss
  3. 14 14
      setup.iss
  4. 5 0
      whatsnew.htm

+ 7 - 1
ISHelp/isetup.xml

@@ -3082,7 +3082,13 @@ Filename: "{win}\MYPROG.INI"; Section: "InstallSettings"; Key: "InstallPath"; St
 <p>Optionally you could also use the <tt>skipifsilent</tt> and <tt>skipifnotsilent</tt> flags and make your application aware of a '/updated' parameter to for example show a nice message box to inform the user that the update has completed.</p>
 </li>
 
-<li>Inno Setup's own installers accept an additional /PORTABLE=1 command line parameter to enable portable mode which causes the installers to not create an uninstaller nor an entry in the Add/Remove Programs Control Panel applet.</li>
+<li>
+<p>Inno Setup's own installers accept an additional /PORTABLE=1 command line parameter to enable portable mode which causes the installers to install to the desktop by default and to not create an uninstaller nor an entry in the Add/Remove Programs Control Panel applet. For example:</p>
+
+<precode>
+/portable=1 /silent /currentuser
+</precode>
+</li>
 
 <li>The Inno Setup backup website can be found at <extlink href="http://www.innosetup.nl/">www.innosetup.nl</extlink>. Normally this link will simply redirect you to the main website at <extlink href="https://jrsoftware.org/">jrsoftware.org</extlink> but in case of emergencies this redirect will be disabled.</li>
 

+ 37 - 0
isportable.iss

@@ -0,0 +1,37 @@
+// -- IsPortable.iss --
+// Include file with support functions for portable mode
+//
+[Code]
+function PortableCheck: Boolean;
+begin
+  Result := ExpandConstant('{param:portable|0}') = '1';
+end;
+
+function GetAppIdOrVersion(Param: String): String;
+begin
+  Result := Param;
+  if PortableCheck then
+    Result := Result + ' Portable';
+end;
+
+function GetDefaultDirName(Param: String): String;
+begin
+  if PortableCheck then
+    Result := '{autodesktop}'
+  else
+    Result := '{autopf}';
+  Result := ExpandConstant(Result + '\' + Param);
+end;
+
+<event('InitializeWizard')>
+procedure IsPortableInitializeWizard;
+begin
+  if PortableCheck then
+    WizardForm.NoIconsCheck.Checked := True;
+end;
+
+<event('ShouldSkipPage')>
+function IsPortableShouldSkipPage(PageID: Integer): Boolean;
+begin
+  Result := (PageID = wpSelectProgramGroup) and PortableCheck;
+end;

+ 14 - 14
setup.iss

@@ -8,10 +8,12 @@
 
 #include "isdonateandmail.iss"
 
+#include "isportable.iss"
+
 [Setup]
 AppName=Inno Setup
-AppId=Inno Setup 6
-AppVersion=6.1.0-beta
+AppId={code:GetAppIdOrVersion|Inno Setup 6}
+AppVersion={code:GetAppIdOrVersion|6.1.0-beta}
 AppPublisher=jrsoftware.org
 AppPublisherURL=https://www.innosetup.com/
 AppSupportURL=https://www.innosetup.com/
@@ -20,14 +22,15 @@ VersionInfoCopyright=Copyright (C) 1997-2020 Jordan Russell. Portions Copyright
 AppMutex=InnoSetupCompilerAppMutex,Global\InnoSetupCompilerAppMutex
 SetupMutex=InnoSetupCompilerSetupMutex,Global\InnoSetupCompilerSetupMutex
 WizardStyle=modern
-DefaultDirName={autopf}\Inno Setup 6
+DefaultDirName={code:GetDefaultDirName|Inno Setup 6}
 DefaultGroupName=Inno Setup 6
-PrivilegesRequiredOverridesAllowed=dialog
+PrivilegesRequiredOverridesAllowed=commandline
 AllowNoIcons=yes
 Compression=lzma2/max
 SolidCompression=yes
 Uninstallable=not PortableCheck
 UninstallDisplayIcon={app}\Compil32.exe
+UsePreviousLanguage=no
 LicenseFile=license.txt
 TimeStampsInUTC=yes
 TouchDate=none
@@ -80,15 +83,15 @@ HelpTextNote=/PORTABLE=1%nEnable portable mode.
 english.WelcomeLabel1=Welcome to the Inno Setup%nSetup Wizard
 
 [Tasks]
-Name: desktopicon; Description: "{cm:CreateDesktopIcon}"; Flags: unchecked
-Name: fileassoc; Description: "{cm:AssocFileExtension,Inno Setup,.iss}"
+Name: desktopicon; Description: "{cm:CreateDesktopIcon}"; Flags: unchecked; Check: not PortableCheck
+Name: fileassoc; Description: "{cm:AssocFileExtension,Inno Setup,.iss}"; Check: not PortableCheck
 
 [InstallDelete]
 ; Remove old ISPP files
 Type: files; Name: "{app}\ISCmplr.dls"
 Type: files; Name: "{app}\Builtins.iss"
 ; Remove desktop icon if needed
-Type: files; Name: {autodesktop}\Inno Setup Compiler.lnk; Tasks: not desktopicon
+Type: files; Name: {autodesktop}\Inno Setup Compiler.lnk; Tasks: not desktopicon; Check: not PortableCheck
 ; Remove old FAQ file
 Type: files; Name: "{app}\isfaq.htm"
 ; Remove old .islu files
@@ -181,6 +184,7 @@ Filename: "{app}\isfaq.url"; Section: "InternetShortcut"; Key: "URL"; String: "h
 Type: files; Name: "{app}\isfaq.url"
 
 [Icons]
+; All these will be automatically skipped on portable mode, either because of NoIconsCheck being checked, or because of the desktopicon task being removed
 Name: "{group}\Inno Setup Compiler"; Filename: "{app}\Compil32.exe"; WorkingDir: "{app}"; AppUserModelID: "JR.InnoSetup.IDE.6"
 Name: "{group}\Inno Setup Documentation"; Filename: "{app}\ISetup.chm"
 Name: "{group}\Inno Setup Example Scripts"; Filename: "{app}\Examples\"
@@ -189,14 +193,10 @@ Name: "{group}\Inno Setup Revision History"; Filename: "{app}\whatsnew.htm"
 Name: "{autodesktop}\Inno Setup Compiler"; Filename: "{app}\Compil32.exe"; WorkingDir: "{app}"; AppUserModelID: "JR.InnoSetup.IDE.6"; Tasks: desktopicon
 
 [Run]
+; The /ASSOC line will be automatically skipped on portable mode, because of the fileassoc task being removed
 Filename: "{app}\Compil32.exe"; Parameters: "/ASSOC"; StatusMsg: "{cm:AssocingFileExtension,Inno Setup,.iss}"; Tasks: fileassoc
 Filename: "{app}\Compil32.exe"; WorkingDir: "{app}"; Description: "{cm:LaunchProgram,Inno Setup}"; Flags: nowait postinstall skipifsilent
 
 [UninstallRun]
-Filename: "{app}\Compil32.exe"; Parameters: "/UNASSOC"; RunOnceId: "RemoveISSAssoc"
-
-[Code]
-function PortableCheck: Boolean;
-begin
-  Result := ExpandConstant('{param:portable|0}') = '1';
-end;
+; The /UNASSOC line will be automatically skipped on portable mode, because of Uninstallable begin set to no
+Filename: "{app}\Compil32.exe"; Parameters: "/UNASSOC"; RunOnceId: "RemoveISSAssoc"

+ 5 - 0
whatsnew.htm

@@ -28,6 +28,11 @@ For conditions of distribution and use, see <a href="https://jrsoftware.org/file
 
 <p><b>Want to be notified by e-mail of new Inno Setup releases?</b> <a href="https://jrsoftware.org/ismail.php">Subscribe</a> to the Inno Setup Mailing List!<br /><b>If you subscribed before October 2019, please resubscribe.</b></p>
 
+<p><a name="6.1.1"></a><span class="ver">6.1.1-dev </span><span class="date">(?)</span></p>
+<ul>
+  <li>The /PORTABLE=1 command line parameter accepted by Inno Setup's own installers has been improved to allow side-by-side installations. For example, to quickly install a new version to the current user's desktop without affecting already installed versions use the following command line parameters: <tt>/portable=1 /silent /currentuser</tt>.</li>
+</ul>
+
 <p><a name="6.1.0"></a><span class="ver">6.1.0-beta </span><span class="date">(2020-09-13)</span></p>
 <p><span class="head2">Per-user fonts</span></p>
 <p>Per-user fonts are now supported if Setup is running on Windows 10 Version 1803 and later:</p>