I'm using pygame to write a game called Bombz which needs to save some
data in a directory associated with it. In Unix/Linux I'd probably use
"~/.bombz", in Windows something like
"C:\Documen ts And Settings\<user> \Applicacation Data\Bombz".
There are plenty of messages in the archives for this group about how to
find the correct location in Windows, but what about Mac OS? There I
don't know the correct location for this sort of thing at all. And there
are other, more obscure systems like RISC OS (it may not have pygame but
it definitely has python). Surely this is something that's crying out
for an official function in os or sys.
--
The address in the Reply-To is genuine and should not be edited.
See <http://www.realh.co.uk/contact.html> for more reliable contact
addresses. 22 2657
Tony Houghton wrote: I'm using pygame to write a game called Bombz which needs to save some data in a directory associated with it. In Unix/Linux I'd probably use "~/.bombz", in Windows something like "C:\Documen ts And Settings\<user> \Applicacation Data\Bombz".
There are plenty of messages in the archives for this group about how to find the correct location in Windows, but what about Mac OS? There I don't know the correct location for this sort of thing at all. And there are other, more obscure systems like RISC OS (it may not have pygame but it definitely has python). Surely this is something that's crying out for an official function in os or sys.
On OS X, the data should probably go to
~/Library/Application Support/Bombz/
--
Robert Kern rk***@ucsd.edu
"In the fields of hell where the grass grows high
Are the graves of dreams allowed to die."
-- Richard Harter
Tony Houghton wrote: I'm using pygame to write a game called Bombz which needs to save some data in a directory associated with it. In Unix/Linux I'd probably use "~/.bombz", in Windows something like "C:\Documen ts And Settings\<user> \Applicacation Data\Bombz".
There are plenty of messages in the archives for this group about how to find the correct location in Windows, but what about Mac OS? There I don't know the correct location for this sort of thing at all. And there are other, more obscure systems like RISC OS (it may not have pygame but it definitely has python). Surely this is something that's crying out for an official function in os or sys.
Perhaps using "import user; user.home" would be adequate. Note the
documented side effects of doing that however.
-Peter
On Tue, 20 Sep 2005 23:03:52 +0100, Tony Houghton wrote: I'm using pygame to write a game called Bombz which needs to save some data in a directory associated with it. In Unix/Linux I'd probably use "~/.bombz", in Windows something like "C:\Documen ts And Settings\<user> \Applicacation Data\Bombz".
In Windows, you shouldn't hard-code the drive letter. I don't know how you
find out what the correct value is, but hard-coding it is just Bad.
As a Linux user, I really am sick of every damn application, script and
program under the sun filling the top level of my home directory with
dot-files.
I wish the Linux Standard Base folks would specify that settings files
should all go into a subdirectory like ~/settings rather than filling up
the home directory with cruft. That was acceptable in the days when people
only looked at their files with ls, but in these days of GUI file
managers, it is ridiculous that there are more than 100 dot files and
directories in my home directory.
<tilting at windmills>
Can I ask developers to break with the obsolete and annoying habit of
creating user-specific config files as ~/.app-name and use
~/settings/app-name instead?
</tilting at windmills>
--
Steven.
Steven D'Aprano wrote: On Tue, 20 Sep 2005 23:03:52 +0100, Tony Houghton wrote:
I'm using pygame to write a game called Bombz which needs to save some data in a directory associated with it. In Unix/Linux I'd probably use "~/.bombz", in Windows something like "C:\Documen ts And Settings\<user> \Applicacation Data\Bombz".
In Windows, you shouldn't hard-code the drive letter. I don't know how you find out what the correct value is, but hard-coding it is just Bad.
As a Linux user, I really am sick of every damn application, script and program under the sun filling the top level of my home directory with dot-files.
I wish the Linux Standard Base folks would specify that settings files should all go into a subdirectory like ~/settings rather than filling up the home directory with cruft. That was acceptable in the days when people only looked at their files with ls, but in these days of GUI file managers, it is ridiculous that there are more than 100 dot files and directories in my home directory.
<tilting at windmills>
Can I ask developers to break with the obsolete and annoying habit of creating user-specific config files as ~/.app-name and use ~/settings/app-name instead?
</tilting at windmills>
While we're asking for the improbable, perhaps we could make that
~/.settings/app-name
Ssh has used the ~/.ssh directory for a long time to avoid the need for
lots of little dot files, and this works quite well. Good luck in your
campaign!
regards
Steve
--
Steve Holden +44 150 684 7255 +1 800 494 3119
Holden Web LLC www.holdenweb.com
PyCon TX 2006 www.pycon.org
On Thu, 22 Sep 2005 00:23:56 +1000, Steven D'Aprano
<st***@REMOVETH IScyber.com.au> declaimed the following in
comp.lang.pytho n: On Tue, 20 Sep 2005 23:03:52 +0100, Tony Houghton wrote:
I'm using pygame to write a game called Bombz which needs to save some data in a directory associated with it. In Unix/Linux I'd probably use "~/.bombz", in Windows something like "C:\Documen ts And Settings\<user> \Applicacation Data\Bombz". In Windows, you shouldn't hard-code the drive letter. I don't know how you find out what the correct value is, but hard-coding it is just Bad.
XP Pro seems to take print os.environ["APPDATA"]
C:\Documents and Settings\Dennis Lee Bieber\Applicat ion Data
Though the more consistent might be to hit the registry:
HKEY_CURRENT_US ER\Software\Mic rosoft\Windows\ CurrentVersion\ Explorer\Shell
Folders\AppData
and to confuse matters, there is also a "Local AppData" entry
-- =============== =============== =============== =============== == < wl*****@ix.netc om.com | Wulfraed Dennis Lee Bieber KD6MOG < wu******@dm.net | Bestiaria Support Staff < =============== =============== =============== =============== == < Home Page: <http://www.dm.net/~wulfraed/> < Overflow Page: <http://wlfraed.home.ne tcom.com/> <
Steven D'Aprano wrote: As a Linux user, I really am sick of every damn application, script and program under the sun filling the top level of my home directory with dot-files.
I wish the Linux Standard Base folks would specify that settings files should all go into a subdirectory like ~/settings rather than filling up the home directory with cruft. That was acceptable in the days when people only looked at their files with ls, but in these days of GUI file managers, it is ridiculous that there are more than 100 dot files and directories in my home directory.
What difference does it make whether one is using a GUI or a command
line? Anyway, the vast majority of Unix users I know still use ls a lot
more often than GUI-based file managers.
I prefer to keep my settings in ~/etc, as a sort of intuitive parallel
to the Filesystem Hierarchy Standard.
<tilting at windmills>
Can I ask developers to break with the obsolete and annoying habit of creating user-specific config files as ~/.app-name and use ~/settings/app-name instead?
</tilting at windmills>
Better: a user-specified $ETCDIR.
> > > I'm using pygame to write a game called Bombz which needs to save some data in a directory associated with it. In Unix/Linux I'd probably use "~/.bombz", in Windows something like "C:\Documen ts And Settings\<user> \Applicacation Data\Bombz".
In Windows, you shouldn't hard-code the drive letter. I don't know how you find out what the correct value is, but hard-coding it is just Bad.
XP Pro seems to take
print os.environ["APPDATA"]
C:\Documents and Settings\Dennis Lee Bieber\Applicat ion Data
Though the more consistent might be to hit the registry:
HKEY_CURRENT_US ER\Software\Mic rosoft\Windows\ CurrentVersion\ Explorer\Shell Folders\AppData
and to confuse matters, there is also a "Local AppData" entry
It isn't just the drive letter you shouldn't hardcode. In different
locales the phrases "Documents and Settings" and "Applicatio n Data"
are often different. The canonical way to get this dir on Windows is by
using the SHGetFolderPath Windows API call with the CSIDL_APPDATA
constant: http://msdn.microsoft.com/library/de...folderpath.asp
In Python code that is:
from win32com.shell import shellcon, shell
path = shell.SHGetFold erPath(0, shellcon.CSIDL_ APPDATA, 0, 0)
Unfortunately that either means having the PyWin32 extensions installed
(which not all Python installations on Windows have) or building your
own small binary extension to make that call. Failing that, using the
registry location or the environment variable above might suffice
Note that on some older Windows flavours -- not sure exactly which --
the APPDATA env. var. might not be defined.
Also note that Windows app guidelines encourage you to have an
additional vendor/owner directory level before the app name. So:
%APPDATA%\<comp any-or-vendor-name>\Bombz
I have a little working script that I use for this kind of stuff which
you are welcome too, if it helps. (attached)
Trent
--
Trent Mick Tr****@ActiveSt ate.com
Steven D'Aprano wrote: On Tue, 20 Sep 2005 23:03:52 +0100, Tony Houghton wrote:
I'm using pygame to write a game called Bombz which needs to save some data in a directory associated with it. In Unix/Linux I'd probably use "~/.bombz", in Windows something like "C:\Documen ts And Settings\<user> \Applicacation Data\Bombz". In Windows, you shouldn't hard-code the drive letter. I don't know
how you find out what the correct value is, but hard-coding it is just Bad.
That's why I said "something like". It seems there is a definitive way
of finding the correct value, but it needs extra W32 extensions
installed. You could also start from os.path.expandu ser('~') I suppose.
As a Linux user, I really am sick of every damn application, script and program under the sun filling the top level of my home directory with dot-files.
I wish the Linux Standard Base folks would specify that settings files should all go into a subdirectory like ~/settings rather than filling up the home directory with cruft. That was acceptable in the days when
people only looked at their files with ls, but in these days of GUI file managers, it is ridiculous that there are more than 100 dot files and directories in my home directory.
Don't all file managers have an option to hide files beginning with '.'?
<tilting at windmills>
Can I ask developers to break with the obsolete and annoying habit of creating user-specific config files as ~/.app-name and use ~/settings/app-name instead?
</tilting at windmills>
You'll probably like the XDG basedir spec then:
<http://freedesktop.org/wiki/Standards_2fbas edir_2dspec>
I suppose I should really use that, but the trouble is it can be very
difficult to decide whether some files are config or data, so it would
be nice to have a standard that doesn't segregate the two.
Thanks to everyone else who's replied. I've saved Trent Mick's script
for later reference.
--
The address in the Reply-To is genuine and should not be edited.
See <http://www.realh.co.uk/contact.html> for more reliable contact
addresses.
On Wed, 21 Sep 2005 20:07:54 +0100, Tony Houghton wrote: > I wish the Linux Standard Base folks would specify that settings files > should all go into a subdirectory like ~/settings rather than filling up > the home directory with cruft. That was acceptable in the days when > people > only looked at their files with ls, but in these days of GUI file > managers, it is ridiculous that there are more than 100 dot files and > directories in my home directory.
Don't all file managers have an option to hide files beginning with '.'?
I don't want to hide them. I just don't want them in my face when I open
my home directory.
--
Steven. This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: jeff elkins |
last post by:
I'm creating an app that relies on a configuration file at launch. The file
will always exist in the app's installation directory, but I have no control
over where that might be.
Is there an OS-independent way that I can instruct the app to look in it's
home directory for startup files? Right now, I'm hard coding the path, which
won't work....
|
by: Peter Rilling |
last post by:
How does Windows store passwords that it uses? For instance, when you
install a service, you can provide it the username and password. This
information is stored somehow so that at a later date the service can start
without interaction from the user. Also for COM+ components.
This is what I want to be able to do. I want the ability to...
|
by: pei_world |
last post by:
hi
I am new to C# programming. can anyone tell me what is the standard way to
store high sensitive user data for application, so that application next run
can get back those data.
|
by: Guadala Harry |
last post by:
What are my options for *securely* storing/retrieving the ID and password
used by an ASP.NET application for accessing a SQL Server (using SQL Server
authentication)? Please note that this ID and password would be different
than the one the user enters for ASP.NET forms authentication. The
ID/password in question is used by the application,...
|
by: Lior |
last post by:
Hi, I have an ASP.NET website that crashes under heavy load.
I use a SQL Server DB. I get around 5500 hits per day. I keep getting the
timeout expieried connection pool error. Sometimes it even throws and error
about a DataReader connection being already open even though I only use Data
Sets in my code.
Please take a look and see if you can...
| |
by: UJ |
last post by:
I have a need to know what the domain name is when I'm running a site.
Essentially the problem I have is that I let the user build a web page and
then I display it using a IFRAME. But the IFRAME wants the entire path, not
just relative. So I need to build entire URL. I can store it in a database
but the problem then becomes people running SSL...
|
by: Rico |
last post by:
Hello,
I have an ole object field (Access XP/2002) which I store images in. I have
a couple of questions regarding this; is it possible to determine the image
dimensions? Secondly, is there any way to determine what application is
associated with the stored OLE Object and is there a way to associate that
object programmatically with...
|
by: Tom E H |
last post by:
My Python application includes some data files that need to be accessed by
modules I distribute with it.
Where can I put them, and how should I arrange my code, so that it works
across platforms?
On Linux, I could install the data to "/usr/lib/myprogram/datafile", and
on Windows to "datafile" relative to where the executable (made by...
|
by: Brian Vanderburg II |
last post by:
Lance Gamet wrote:
Lance Gamet wrote:
One way I've just started to use it to create a utility function to
return the location of the user data folder, depending on the operating
system:
import os, sys
def GetUserDataDirectory():
dir = None
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it. ...
| |
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in...
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...
| |