Inno Setup Installing to AppData\Roaming on Windows Vista/7 and newer, but Application Data on Windows XP

感情迁移 提交于 2019-12-22 17:52:07

问题


I have made several scripts for inDesign. Now I want to distribute them all in a setup file. Since inDesign scripts reside in different locations on XP and Vista (or above), I'm having some problems. My compiled setup works fine under Windows XP but doesn't copy anything to Windows 7 AppData folder. When I change folder from AppData to an absolute path, it works.

[Files]
Source: "Akruti Converter.jsx"; DestDir: "{userappdata}\Roaming\Adobe\InDesign\Version 8.0\en_US\Scripts\Scripts Panel\Unicode Converters\Plain"; Check: IsWindowsVista_or_7
Source: "Akruti Converter.jsx"; DestDir: "C:\Unicode Converters\Plain"
Source: "ShreeLipi v4,5,6 Converter.jsx"; DestDir: "{userappdata}\Roaming\Adobe\InDesign\Version 8.0\en_US\Scripts\Scripts Panel\Unicode Converters\Plain"; Check: IsWindowsVista_or_7
Source: "Smart Akruti Converter.jsx"; DestDir: "{userappdata}\Roaming\Adobe\InDesign\Version 8.0\en_US\Scripts\Scripts Panel\Unicode Converters\Smart"; Check: IsWindowsVista_or_7

Source: "Akruti Converter.jsx"; DestDir: "{userappdata}\Adobe\InDesign\Version 8.0\en_US\Scripts\Scripts Panel\Unicode Converters\Plain"; Check: IsWindowsXP
Source: "ShreeLipi v4,5,6 Converter.jsx"; DestDir: "{userappdata}\Adobe\InDesign\Version 8.0\en_US\Scripts\Scripts Panel\Unicode Converters\Plain"; Check: IsWindowsXP
Source: "Smart Akruti Converter.jsx"; DestDir: "{userappdata}\Adobe\InDesign\Version 8.0\en_US\Scripts\Scripts Panel\Unicode Converters\Smart"; Check: IsWindowsXP

[Code]

function IsWindowsXP: Boolean;
var
  Version: TWindowsVersion;
begin
  GetWindowsVersionEx(Version);
  Result := Version.NTPlatform and (Version.Major = 5) and (Version.Minor = 1);
end;

function IsWindowsVista_or_7: Boolean;
var
  Version: TWindowsVersion;
begin
  GetWindowsVersionEx(Version);
  Result := Version.NTPlatform and (Version.Major = 6) and ((Version.Minor = 1));
end;

回答1:


The {userappdata} constant resolves to C:\Users\username\AppData\Roaming on Windows Vista an newer.

So {userappdata}\Roaming resolves to C:\Users\username\AppData\Roaming\Roaming, what is (probably) not what you want.

On Windows XP, the {userappdata} resolves to C:\Documents and Settings\username\Application Data (no Roaming).

Hence, I believe you can use {userappdata} on all versions of Windows, including XP, with desired results. You do not need those conditional entries with IsWindowsXP and IsWindowsVista_or_7.

In other words, I believe, the installation path is the same on Windows XP and Windows 7. In both cases it is under SHGetFolderPath(CSIDL_APPDATA) what is {userappdata} in Inno Setup.

[Files]
Source: "Akruti Converter.jsx"; \
    DestDir: "{userappdata}\Adobe\InDesign\Version 8.0\en_US\Scripts\Scripts Panel\Unicode Converters\Plain"

Side note: Your IsWindowsVista_or_7 is implemented as "IsWindows7" only. It won't return true on Windows Vista. It should return true on Windows 8/10 too.




回答2:


if you are only into distribution, you may consider Adobe AddOns that will deal with all the platform related installation technical aspects.



来源:https://stackoverflow.com/questions/34480367/inno-setup-installing-to-appdata-roaming-on-windows-vista-7-and-newer-but-appli

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!