Filehandling

I’ve wanted a portable way of doing config files ever since I
cross-compiled my first game to Windows. :slight_smile:

> > This is what (and all) libfnkdat does :). > http://www.maccormack.net/~djm/libfnkdat/

Ooh! Excellent! I’m checking it out, thanks!

Anyone working on BeOS, MacOS, etc. ports?

-bill!On Sat, Mar 02, 2002 at 05:55:26PM -0500, David MacCormack wrote:

On Sat, 2 Mar 2002, nbs wrote:

Starcraft is a bad example of a win32 app (the one they give on their
site) nowadays because WinXP Professional has permissions which may make
you unable to write to the Starcraft directory. Under NT, you can’t
really expect to be able to write file anywhere outside of your profile
directory. That’s usually C:\Documents and Settings<username>.

I’m currently on a crusade to get win32 people to cope with this change in
paradigm for the obvious security implications and because my family’s XP
box is set up this way and it pisses me off when they install something
that doesn’t work with it and I’m supposed to fix it. ;)On Sun, Mar 03, 2002 at 02:35:51AM -0800, nbs wrote:

I’ve wanted a portable way of doing config files ever since I
cross-compiled my first game to Windows. :slight_smile:

> > This is what (and all) libfnkdat does :). > http://www.maccormack.net/~djm/libfnkdat/

Ooh! Excellent! I’m checking it out, thanks!

Anyone working on BeOS, MacOS, etc. ports?


Joseph Carter What’re you looking at?

  • cesarb wonders if in less than a week Carmack will end up receiving in
    e-mail a courtesy copy of a version of the Quake source which is four
    times faster than what went out of his virtual hands…

-------------- next part --------------
A non-text attachment was scrubbed…
Name: not available
Type: application/pgp-signature
Size: 273 bytes
Desc: not available
URL: http://lists.libsdl.org/pipermail/sdl-libsdl.org/attachments/20020303/a2e9a1fe/attachment.pgp

I’ve wanted a portable way of doing config files ever since I
cross-compiled my first game to Windows. :slight_smile:

This is what (and all) libfnkdat does :).
http://www.maccormack.net/~djm/libfnkdat/

Ooh! Excellent! I’m checking it out, thanks!

Anyone working on BeOS, MacOS, etc. ports?

Starcraft is a bad example of a win32 app (the one they give on their
site) nowadays because WinXP Professional has permissions which may
make you unable to write to the Starcraft directory. Under NT, you
can’t really expect to be able to write file anywhere outside of your
profile directory. That’s usually C:\Documents and
Settings<username>.

Simple question: (I would think…)

How do you find out where the profile dir is, in a way that works on any
Win32? Or, if I’m not supposed to use it on some Windows version, how
do I find that out?

(On many other platforms you just read the system variable “HOME” to find
the “corresponding” place, but I bet that doesn’t work on any Windows
version… heh)

I’m currently on a crusade to get win32 people to cope with this change
in paradigm for the obvious security implications and because my
family’s XP box is set up this way and it pisses me off when they
install something that doesn’t work with it and I’m supposed to fix it.
:wink:

Well, if you can answer the above, I’ll try to fix it in the filemapper_t
of Kobo Deluxe. :wink:

It currently does the right thing even on Mac OS X (which I don’t use
myself) - but it doesn’t on Windows, which is one of my two “officially
supported” targets! heh

//David Olofson — Programmer, Reologica Instruments AB

.- M A I A -------------------------------------------------.
| Multimedia Application Integration Architecture |
| A Free/Open Source Plugin API for Professional Multimedia |
----------------------------> http://www.linuxdj.com/maia -' .- David Olofson -------------------------------------------. | Audio Hacker - Open Source Advocate - Singer - Songwriter |-------------------------------------> http://olofson.net -'On Sunday 03 March 2002 20:59, Joseph Carter wrote:

On Sun, Mar 03, 2002 at 02:35:51AM -0800, nbs wrote:

Quoting David Olofson <david.olofson at reologica.se>:

Simple question: (I would think…)

for certain values of ‘simple’ anyway :slight_smile:

How do you find out where the profile dir is, in a way that works on any

Win32? Or, if I’m not supposed to use it on some Windows version, how

do I find that out?

The DLL shfolder.dll has a function SHGetFolderPath that takes the ID of the
folder you’re looking for, and returns the actual path. Useful values are
CSIDL_APPDATA (user specific app data - save files and such should go here) and
CSIDL_COMMON_APPDATA (shared data - maps, textures, etc should go here). Note
that the ‘common’ directories are read-only for normal users undermost recent
Windows versions (NT/2000/XP) The directory found as CSIDL_PROFILE
(C:\Documents And Settings\Username or something like that :slight_smile: may well be the
only directory you can write to as a normal user. Of course, this includes your
desktop, My Documents, etc) There’s a whole lot more things that function can
find, too - search for it on msdn.microsoft.com for more info.

This DLL is standard in NT and derivatives, supplied with recent versions of IE
(5.0 and above), and is a redistributable for earlier versions (ie, Win95
without a recent IE). That may or may not count as good news.

(On many other platforms you just read the system variable “HOME” to
find
the “corresponding” place, but I bet that doesn’t work on any Windows
version… heh)

I found SHGetFolderPath while looking for how to find the ‘home’ directory :slight_smile:

It’s pretty bad news to me, as I don’t want to depend on something that
will only be available on NT derivates… I would think that it’s
possible to find this information using some API that is actually a part
of the “standard” Win32 API.

//David Olofson — Programmer, Reologica Instruments AB

.- M A I A -------------------------------------------------.
| Multimedia Application Integration Architecture |
| A Free/Open Source Plugin API for Professional Multimedia |
----------------------------> http://www.linuxdj.com/maia -' .- David Olofson -------------------------------------------. | Audio Hacker - Open Source Advocate - Singer - Songwriter |-------------------------------------> http://olofson.net -'On Monday 04 March 2002 21:26, Andrew Murie wrote:

Quoting David Olofson <david.olofson at reologica.se>:

Simple question: (I would think…)

for certain values of ‘simple’ anyway :slight_smile:

How do you find out where the profile dir is, in a way that works on
any

Win32? Or, if I’m not supposed to use it on some Windows version,
how

do I find that out?

The DLL shfolder.dll has a function SHGetFolderPath that takes the ID
of the folder you’re looking for, and returns the actual path. Useful
values are CSIDL_APPDATA (user specific app data - save files and such
should go here) and CSIDL_COMMON_APPDATA (shared data - maps, textures,
etc should go here). Note that the ‘common’ directories are read-only
for normal users undermost recent Windows versions (NT/2000/XP) The
directory found as CSIDL_PROFILE (C:\Documents And Settings\Username or
something like that :slight_smile: may well be the only directory you can write to
as a normal user. Of course, this includes your desktop, My Documents,
etc) There’s a whole lot more things that function can find, too -
search for it on msdn.microsoft.com for more info.

This DLL is standard in NT and derivatives, supplied with recent
versions of IE (5.0 and above), and is a redistributable for earlier
versions (ie, Win95 without a recent IE). That may or may not count as
good news.

Quoting David Olofson <david.olofson at reologica.se>:

It’s pretty bad news to me, as I don’t want to depend on something that
will only be available on NT derivates… I would think that it’s
possible to find this information using some API that is actually a part

maybe I wasn’t as clear as I should have been - the DLL works fine on 95 & 98,
and is legally redistributable (in any case, if people have updated to IE5
they’ll have it already). (It’s even aware of the differences between the OS
versions - NT/XP seem to be structured differently, but the appropriate
directories still exist, just with different names (I guess the tricky bit is
making sure your installer uses the same library to find the directories)

Starcraft is a bad example of a win32 app (the one they give on their
site) nowadays because WinXP Professional has permissions which may
make you unable to write to the Starcraft directory. Under NT, you
can’t really expect to be able to write file anywhere outside of your
profile directory. That’s usually C:\Documents and
Settings<username>.

Simple question: (I would think…)

How do you find out where the profile dir is, in a way that works on any
Win32? Or, if I’m not supposed to use it on some Windows version, how
do I find that out?

Simple answer: You don’t. Either you use the registry which supports the
win9x version of multi-user, or you pick a place and put them there. I’m
sure there’s a Microsoft-sanctioned way to figure out where to put things
like this, but I don’t know what that is.

(On many other platforms you just read the system variable “HOME” to find
the “corresponding” place, but I bet that doesn’t work on any Windows
version… heh)

Not a chance. You can use %HOMEDRIVE%%HOMEPATH% in NT though. Hey, NT
has the POSIX-mandated HOME environment, right? That counts doesn’t it?
THWACK! Ahh, much better now.

I’m currently on a crusade to get win32 people to cope with this change
in paradigm for the obvious security implications and because my
family’s XP box is set up this way and it pisses me off when they
install something that doesn’t work with it and I’m supposed to fix it.
:wink:

Well, if you can answer the above, I’ll try to fix it in the filemapper_t
of Kobo Deluxe. :wink:

It currently does the right thing even on Mac OS X (which I don’t use
myself) - but it doesn’t on Windows, which is one of my two “officially
supported” targets! heh

Understood. I wish I could be more help.On Mon, Mar 04, 2002 at 08:09:17PM +0100, David Olofson wrote:


Joseph Carter No conceit in my family

  • SynrG notes that the number of configuration questions to answer in
    sendmail is NON-TRIVIAL

-------------- next part --------------
A non-text attachment was scrubbed…
Name: not available
Type: application/pgp-signature
Size: 273 bytes
Desc: not available
URL: http://lists.libsdl.org/pipermail/sdl-libsdl.org/attachments/20020304/7a7fd954/attachment.pgp

Quoting David Olofson <david.olofson at reologica.se>:

It’s pretty bad news to me, as I don’t want to depend on something
that will only be available on NT derivates… I would think that
it’s possible to find this information using some API that is
actually a part

maybe I wasn’t as clear as I should have been - the DLL works fine on
95 & 98, and is legally redistributable

I’d have to read the term. (For some reasons, I have a feeling that
they’re not compatible with GPLed software… :slight_smile:

(in any case, if people have
updated to IE5 they’ll have it already).

So I have to distribute M$ code with my Win32 builds, or ask people to
install the DLL some other way - or my game won’t even load. I don’t like
the sound of that. heh

(It’s even aware of the
differences between the OS versions - NT/XP seem to be structured
differently, but the appropriate directories still exist, just with
different names (I guess the tricky bit is making sure your installer
uses the same library to find the directories)

Sounds like even more fun! :wink:

//David Olofson — Programmer, Reologica Instruments AB

.- M A I A -------------------------------------------------.
| Multimedia Application Integration Architecture |
| A Free/Open Source Plugin API for Professional Multimedia |
----------------------------> http://www.linuxdj.com/maia -' .- David Olofson -------------------------------------------. | Audio Hacker - Open Source Advocate - Singer - Songwriter |-------------------------------------> http://olofson.net -'On Monday 04 March 2002 22:56, Andrew Murie wrote: