Maybe OT? How to discover a home directory for any system?

For my project, I need to be able to save games, settings and other
things on a per-user basis. I’m primarily a Linux developer, and
obviously for Linux/Unix the best way is to tuck it away in a hidden
directory in the users home directory. The problem is that I have no
idea where to put these files for windows, mac or OSX. I’m fairly sure
that for OSX it’s the same as Unix, but for windows I have no idea. If
I remember correctly the place to put files like this has changed
several times from version to version.

The question is: does anyone know a good clean way to decide for

windows? And the offshoot of that question is: should SDL provide some
means of getting that information?

Aaron.–
Jimmy <@Jimmy>
Jimmy’s World

I always thought so (or, e.g., an add-on library) :^)

-bill!On Tue, Apr 13, 2004 at 01:03:26AM -0400, Jimmy wrote:

The question is: does anyone know a good clean way to decide for
windows? And the offshoot of that question is: should SDL provide some
means of getting that information?

Jimmy <jimmy jimmysworld.org> writes:

For my project, I need to be able to save games, settings and other
things on a per-user basis. I’m primarily a Linux developer, and
obviously for Linux/Unix the best way is to tuck it away in a hidden
directory in the users home directory. The problem is that I have no
idea where to put these files for windows, mac or OSX. I’m fairly sure
that for OSX it’s the same as Unix, but for windows I have no idea. If
I remember correctly the place to put files like this has changed
several times from version to version.

The question is: does anyone know a good clean way to decide for
windows? And the offshoot of that question is: should SDL provide some
means of getting that information?

Aaron.

For win you have 2 options:

  • Create a “SavedGames” folder in the game’s installation dir.
    So if your game gets installed in C:\Games<your project name>
    then use C:\Games<\SavedGames<username>
    (this is probably best (and it is what most games do), since you
    don’t have to worry about win versions and stuff)

  • For XP, per user data get normally stored in:
    C:\Documents and Settings<username>\Application Data<your project name>
    (not sure how things used to work in 2k, 98, 95, etc.)

hope that helps,
k.

2000 works in the same exact manor
-mikeOn Tuesday 13 April 2004 06:33 am, Kos wrote:

  • For XP, per user data get normally stored in:
    C:\Documents and Settings<username>\Application Data<your project
    name>\ (not sure how things used to work in 2k, 98, 95, etc.)

Use Windows API calls?
Don’t know wich function retrievs the user dir, but there are functions like
GetWindowsDirectory() etc. So if you just look at the Win API documentation
you wll surely find something to help u.
Not sure if the exact same approach can be used in Win95/98 but otherwise
you could make a dir on the users computer (i.e.
C:\Program\YourProgramsName\Profilename) and then save the profile name to
use for this user in the registry.

Best regards
Daniel Liljeberg> ----- Original Message -----

From: vapier@gentoo.org (Mike Frysinger)
To:
Sent: Tuesday, April 13, 2004 7:25 PM
Subject: Re: [SDL] Re: Maybe OT? How to discover a home directory for any
system?

On Tuesday 13 April 2004 06:33 am, Kos wrote:

  • For XP, per user data get normally stored in:
    C:\Documents and Settings<username>\Application Data<your project
    name>\ (not sure how things used to work in 2k, 98, 95, etc.)

2000 works in the same exact manor
-mike


SDL mailing list
SDL at libsdl.org
http://www.libsdl.org/mailman/listinfo/sdl

The question is: does anyone know a good clean way to decide for
windows? And the offshoot of that question is: should SDL provide some
means of getting that information?

Aaron.

fnkdat should do what you need:

http://savannah.nongnu.org/projects/fnkdat
http://www.maccormack.net/~djm/fnkdat/

DaveOn Tue, 13 Apr 2004, Jimmy wrote:

fnkdat should do what you need:

http://savannah.nongnu.org/projects/fnkdat
http://www.maccormack.net/~djm/fnkdat/

Dave

This looks like it will do pretty much exactly what I want. Thanks.On Tue, 2004-04-13 at 16:24, David MacCormack wrote:


Jimmy <@Jimmy>
Jimmy’s World