A good default path name for installer script?

Miscellaneous Forums/General Discussion/A good default path name for installer script?

Hi folks,

I'm guessing that for an installer script a 'good' default pathname 'may' be:-

C:/Program Files

Alternatively, I am tempted to opt for

C:/

and let the user take it from there. Does anyone have any recommendations ?

Innosetup uses {pf} by default.

You need to retrieve paths from environment vars or API calls, since they vary from OS to OS.

[edit] You also can't guarantee that the OS is installed on C:.

thanks... will opt for that simply {pf} then.

I wish there was a /home directory on Windows.

Well, it's really the same deal with Linux (Unix, I guess, but Linux is the only such OS supported by Blitz products). You'll want to use environment variables to get the right paths, or else bad things happen.
Strange that we can trust the arbitrary environment variables not to change, but meh.

Innosetup gives the option to 'browse for your directory of choice', I (maybe nievely) trust users can do at least this much....

Then again - never assume ?

The biggest problem with most installers is that if you do browse for a different folder (I for instance like to keep my games in D:\Installed Games\) it often fails to append it's own directory to the path you specify when browsing. The Amiga installers where much better in this regard - sad really that 12 year old software is more state of the art, than what we have today.

I wish there was a /home directory on Windows.

well there is... but its not as nice or as organised as nux's:
"/home/user"

looks like:
"c:\documents and settings\user" (horrid, long and annoying to type :)
But.. like most windows things it also bloats it with lots of invisible, nonsensical crap :P

Anyway...

Automatically assuming it will be "program files" is not good, as foreign pcs dont allways call it this. eg, swedish ones its simply called "program" not "program files".

Its better to use inno or something like gfk said as it picks up {pf} as whatever it is set to in windows.

The windows environment variable PROGRAMFILES will tell you where applications should be installed (by default).

The current user "home" directory is held in the environment variable USERPROFILE or in HOMEDRIVE & HOMEPATH.

Application data is in APPDATA.

All users profile (used for everyone who uses the PC, is ALLUSERSPROFILE

i think windows may recognise these in %%s
ie from cmd:
"cd %HOMEPATH%" - home folder (like "cd ~" in linux)
"cd %PROGRAMFILES%" - the programs folder
"cd %SYSTEMROOT%" - the windows folder
etc...

i dont know if you could do this in a blitz path tho, i guess you should be able to :/
ie writefile("%PROGRAMFILES%\myprog\afile.ext")
it might work..

thanks dan...