Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number

Re: Re: "Porting" scripts to Win32

by meetraz (Hermit)
on Feb 20, 2004 at 14:17 UTC ( #330546=note: print w/replies, xml ) Need Help??

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)


Replies are listed 'Best First'.
Re: Re: Re: "Porting" scripts to Win32
by disciple (Pilgrim) on Feb 21, 2004 at 04:24 UTC

    I would just like to add that while you are correct that the registry "was designed to alleviate the problems of having thousands of configuration files scattered all over the machine, each with a different syntax", Microsoft has now realized that it's design did not accomplish that well. They have decided that application specific configuration files are a better approach. They recommend them for all .NET applications and it is how ASP.NET applications are configured (for features such as Authentication, Session State, Application Variables, etc). The config files are in an XML format and are easily parsed using classes in the "System.Configuration" namespace.

    In response to the OP: Most open source applications I have installed on my W2K box are ports of linux apps. They store their information in config files under "\Documents and Settings\username\appname\" or "\Documents and Settings\username\Application Data\appname\". Most people familiar with the linux apps ported to windows will expect one of those two methods.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://330546]
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others meditating upon the Monastery: (5)
As of 2017-08-22 11:53 GMT
Find Nodes?
    Voting Booth?
    Who is your favorite scientist and why?

    Results (335 votes). Check out past polls.