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

2

5

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;
Tse answered 27/12, 2015 at 12:25 Comment(0)
G
8

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/11 too.

See IsWindowsVistaOrNewer in my answer to Determine Windows version in Inno Setup.

Goldbrick answered 27/12, 2015 at 15:57 Comment(0)
U
1

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

Uralian answered 28/12, 2015 at 23:21 Comment(1)
Thanks. I'll look into it!Tse

© 2022 - 2024 — McMap. All rights reserved.