[英]Inno Setup: Use “Program Files” directory on both 32bit/64bit systems with {pf}
The constant {pf} is the directory of常量 {pf} 是目录
C:\\Program Files
C:\\程序文件
for 32bit systems and对于 32 位系统和
C:\\Program Files (x86)
C:\\程序文件 (x86)
for 64bit systems.对于 64 位系统。
However I want to use the directory但是我想使用目录
C:\\Program Files
C:\\程序文件
for both, 32 and 64bit systems.对于 32 位和 64 位系统。 How can I achieve this?
我怎样才能做到这一点?
Use a scripted constant like:使用 脚本常量,如:
[Setup]
DefaultDirName={code:GetProgramFiles}\My Program
[Code]
function GetProgramFiles(Param: string): string;
begin
if IsWin64 then Result := ExpandConstant('{pf64}')
else Result := ExpandConstant('{pf32}')
end;
Though this approach should only be used, if you generate binaries for the respective platform on the fly.虽然这种方法应该只使用,如果你在运行中为相应的平台生成二进制文件。 Like in your case, if understand correctly, you compile the Java binaries for the respective architecture.
就像你的情况一样,如果理解正确,你就可以为各自的体系结构编译 Java 二进制文件。
If you have a separate 32-bit and 64-bit binaries in the installer, use a script like:如果安装程序中有单独的 32 位和 64 位二进制文件,请使用如下脚本:
[Files]
Source: "MyDll32.dll"; DestDir: "{pf32}\My Program"; Check: not IsWin64
Source: "MyDll64.dll"; DestDir: "{pf64}\My Program"; Check: IsWin64
See also:另见:
If you are using a single installer for both 64 and 32 bit installs then you should be using the ArchitecturesInstallIn64BitMode
Setup Directive.如果您为 64 位和 32 位安装使用单个安装程序,那么您应该使用
ArchitecturesInstallIn64BitMode
安装指令。 This will change {pf} and other scripted constants to be their 64 bit version when installing on a 64 bit system, and their 32 bit versions when installing on a 32 bit system.这将在 64 位系统上安装时将 {pf} 和其他脚本常量更改为 64 位版本,在 32 位系统上安装时将其更改为 32 位版本。
You will obviously also want to use a Check as in Martin's example to make sure you are only installing the correct binaries.您显然还想使用 Martin 示例中的 Check 来确保您只安装了正确的二进制文件。
Ex:例如:
#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;
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.