Inno Setup:在带有 {pf} 的 32 位/64 位系统上使用 "Program Files" 目录
Inno Setup: Use "Program Files" directory on both 32bit/64bit systems with {pf}
常量{pf}是
的目录
C:\Program Files
对于 32 位系统和
C:\Program Files (x86)
对于 64 位系统。
不过我想使用目录
C:\Program Files
对于 32 位和 64 位系统。我怎样才能做到这一点?
使用 scripted constant 如:
[Setup]
DefaultDirName={code:GetProgramFiles}\My Program
[Code]
function GetProgramFiles(Param: string): string;
begin
if IsWin64 then Result := ExpandConstant('{commonpf64}')
else Result := ExpandConstant('{commonpf32}')
end;
虽然这种方法只适用于动态为相应平台生成二进制文件的情况。就像你的情况一样,如果理解正确,你会为各自的体系结构编译 Java 二进制文件。
您也可以使用64-bit install mode。
然后你可以简单地使用{autopf}
constant(以前是{pf}
):
[Setup]
DefaultDirName={autopf}\My Program
如果安装程序中有单独的 32 位和 64 位二进制文件,请使用如下脚本:
[Files]
Source: "MyDll32.dll"; DestDir: "{pf32}\My Program"; Check: not IsWin64
Source: "MyDll64.dll"; DestDir: "{pf64}\My Program"; Check: IsWin64
另请参阅:
- Is it possible to set the install mode in Inno Setup (32 or 64 bit)?
- Inno Setup 32bit and 64bit dll installation
如果您使用一个安装程序进行 64 位和 32 位安装,那么您应该使用 ArchitecturesInstallIn64BitMode
安装指令。这将在 64 位系统上安装时将 {pf} 和其他脚本常量更改为 64 位版本,在 32 位系统上安装时更改为 32 位版本。
您显然还想使用 Martin 示例中的检查来确保您只安装了正确的二进制文件。
例如:
#define MyAppName "MyAwesomeApp"
[Setup]
ArchitecturesInstallIn64BitMode=x64
AppName={#MyAppName}
DefaultDirname={pf}\{#MyAppName}
[Files]
Source: "MyApp_32bit.exe"; DestDir: "{app}"; Check not Is64BitinstallMode;
Source: "MyApp_64bit.exe"; DestDir: "{app}"; Check Is64BitinstallMode;
常量{pf}是
的目录C:\Program Files
对于 32 位系统和
C:\Program Files (x86)
对于 64 位系统。
不过我想使用目录
C:\Program Files
对于 32 位和 64 位系统。我怎样才能做到这一点?
使用 scripted constant 如:
[Setup]
DefaultDirName={code:GetProgramFiles}\My Program
[Code]
function GetProgramFiles(Param: string): string;
begin
if IsWin64 then Result := ExpandConstant('{commonpf64}')
else Result := ExpandConstant('{commonpf32}')
end;
虽然这种方法只适用于动态为相应平台生成二进制文件的情况。就像你的情况一样,如果理解正确,你会为各自的体系结构编译 Java 二进制文件。
您也可以使用64-bit install mode。
然后你可以简单地使用{autopf}
constant(以前是{pf}
):
[Setup]
DefaultDirName={autopf}\My Program
如果安装程序中有单独的 32 位和 64 位二进制文件,请使用如下脚本:
[Files]
Source: "MyDll32.dll"; DestDir: "{pf32}\My Program"; Check: not IsWin64
Source: "MyDll64.dll"; DestDir: "{pf64}\My Program"; Check: IsWin64
另请参阅:
- Is it possible to set the install mode in Inno Setup (32 or 64 bit)?
- Inno Setup 32bit and 64bit dll installation
如果您使用一个安装程序进行 64 位和 32 位安装,那么您应该使用 ArchitecturesInstallIn64BitMode
安装指令。这将在 64 位系统上安装时将 {pf} 和其他脚本常量更改为 64 位版本,在 32 位系统上安装时更改为 32 位版本。
您显然还想使用 Martin 示例中的检查来确保您只安装了正确的二进制文件。
例如:
#define MyAppName "MyAwesomeApp"
[Setup]
ArchitecturesInstallIn64BitMode=x64
AppName={#MyAppName}
DefaultDirname={pf}\{#MyAppName}
[Files]
Source: "MyApp_32bit.exe"; DestDir: "{app}"; Check not Is64BitinstallMode;
Source: "MyApp_64bit.exe"; DestDir: "{app}"; Check Is64BitinstallMode;