http://qs321.pair.com?node_id=330546


in reply to Re: "Porting" scripts to Win32
in thread "Porting" scripts to Win32

I can't help but reply to some of this.

%TEMP% and %SYSTEMROOT% will work only from the shell. To access these in perl, use $ENV{TEMP} and $ENV{SYSTEMROOT}.

Yes, the "Appliation Data" directory under "Documentions and Settings" is the right thing to use for DATA if you're on Win2k or XP, but it doesn't exist on other versions of Windows. To play it safe, use the Win32::GetFolderPath() function, which will always return the proper path regardless of which OS you're on, what changes the network admin has made, or what the user's preferences are. (Try CSIDL_APPDATA or CSIDL_PERSONAL)

The registry is NOT just for system-specific things. Almost Every application on your computer uses the registry to store its configuration info. It was designed to alleviate the problems of having thousands of configuration files scattered all over the machine, each with a different syntax.

To summarize, DATA (like large files) should go in whatever path Win32::GetFolderPath() gives you, and CONFIG (like simple settings) should go in the registry.

Most appliations do NOT use INI files under Winnt. This was common in the Windows 3.1 days, but not any more. The files there are only for legacy compatibility. (And "Winnt" doesn't even exist in the newer OSes like XP)

</rant>