PDA

View Full Version : different install path depending on Windows version?


gnznroses
09-08-2007, 12:04 AM
on Windows 2000 or greater, i need to install most of my files to %ApplicationDataFolderCommon%, however on Windows 95/98, i need to install them to %AppFolder%, because on 95/98 using SHGetSpecialFolderLocation to get that path (CSIDL_AllUsersAppData) returns an empty string. so i plan on detecting the windows version from within my app, and if it's 95/98 just using the App Dir to read the needed files.

how can i change the install path depending on windows version?

btw, i notice %ApplicationDataFolderCommon%, on windows 98, returns something like C:\Windows\Profiles\All Users\Application Data, but i can't find an API to do the same from within my program. i could write the path to an tx file, post-install, but i'd rather not.

pww
09-09-2007, 07:01 AM
something like this should do it. OS major version >= 5 matches Windows 2000 and later, AppFolder will remain unchanged on 9.x/Me/NT4


if System.GetOSVersionInfo().MajorVersion >= "5" then
SessionVar.Set("%AppFolder%", SessionVar.Expand("%ApplicationDataFolderCommon%") .. "\\myApp");
--Dialog.Message("AppFolder:",SessionVar.Expand("%AppFolder%"));
end;

gnznroses
09-11-2007, 02:29 PM
awesome, thanks.

i was thinking maybe i had to install everything to a temp folder and then use the File.Install action on each... this is much easier.

on 2000/XP/Vista i still need some files installed to AppFolder (meaning the path the user chooses to install to, in Program Files), and the rest in ApplicationDataFolderCommon, so your code won't work as is (making both paths the same), but i figure i can work something out.