PDA

View Full Version : Newbie Trying to Set AppFolder


rodscher
03-26-2006, 07:20 PM
Hi, all. I'm trying to reset the default installation folder for an app, depending on whether or not the user has already installed a previous version. I'm able to locate the EXE file itself, but then I'm stumped; how do I change the default app folder to reflect the location of that (previously installed) file?

Here's what I'm using to find the file (mostly snagged from someone else's previous post on a related subject - thanks!):



for i,v in tbDrives do
if Drive.GetType(v) == DRIVE_FIXED then
tbFile = File.Find(v, "MyApp.exe", true, false, nil, nil);
if not tbFile then
else
-- SET THE DEFAULT INSTALL FOLDER HERE!
break
end
end
end



I figure I could also do it by checking the Registry to find the app's current location, but I didn't get anywhere with that, either.

Seems simple enough, so I must just not be understanding something about syntax, variables, etc. (Or else I need sleep.)

Thanks for any help you can offer!

Adam
03-27-2006, 10:42 AM
Try something like this:


for i,v in tbDrives do
if Drive.GetType(v) == DRIVE_FIXED then
tbFile = File.Find(v, "MyApp.exe", true, false, nil, nil);
if not tbFile then

else
Paths = String.SplitPath(tbFile[1]);
SessionVar.Set("%AppFolder%", Paths.Drive..Paths.Folder);
end
end
end



Adam Kapilik