Save in home directory

Linux specific forum
User avatar
Brujah
Enthusiast
Enthusiast
Posts: 237
Joined: Mon Nov 03, 2003 7:45 pm
Location: Germany
Contact:

Save in home directory

Post by Brujah »

I want to save my savegames in the users home directory.
But simply adding "~/" to the path does not work.
How could I achieve this then?
freak
PureBasic Team
PureBasic Team
Posts: 5940
Joined: Fri Apr 25, 2003 5:21 pm
Location: Germany

Post by freak »

The '~' expansion is done by the shell, so it won't work with PB commands.
Use PeekS(getenv_("HOME")) to get the home dir and add it to your filenames.
quidquid Latine dictum sit altum videtur
Nik
Addict
Addict
Posts: 1017
Joined: Fri May 13, 2005 11:45 pm
Location: Germany
Contact:

Post by Nik »

You could use

Code: Select all

string.s=peekS(getenv_("HOME"))
(untested)
Last edited by Nik on Wed Sep 27, 2006 11:53 am, edited 1 time in total.
Nik
Addict
Addict
Posts: 1017
Joined: Fri May 13, 2005 11:45 pm
Location: Germany
Contact:

Post by Nik »

argh Freak your to fast, seriously
User avatar
Brujah
Enthusiast
Enthusiast
Posts: 237
Joined: Mon Nov 03, 2003 7:45 pm
Location: Germany
Contact:

Post by Brujah »

Okay. I tried this code. And I think that solves my problem.
Thanx!
andreyu
User
User
Posts: 16
Joined: Sun Oct 01, 2006 7:12 pm
Location: Belarus
Contact:

Post by andreyu »

I think that developers should add universal function - getprofilepath().
On Linux it should return users home path (/home/users_home/).
On Windows it should return profile path (C:\Documets and settings\users_login_name\).
Regards, _Andrey_
http://www.wegroup.org
Post Reply