[Python-Dev] [Python-3000] Reminder: last alphas next Wednesday 07-May-2008 (original) (raw)
Bill Janssen janssen at parc.com
Fri May 2 20:10:27 CEST 2008
- Previous message: [Python-Dev] Reminder: last alphas next Wednesday 07-May-2008
- Next message: [Python-Dev] Reminder: last alphas next Wednesday 07-May-2008
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Windows and Mac OS X have dedicated directories for application specific libraries. That is ~/Library on Mac and Application Data on Windows.
In fact, I had to write code for this, and had to read the specs for each. Here's the code (I've substituted Python for UpLib):
if sys.platform == 'darwin':
listdir = os.path.expanduser(os.path.join("", "Library", "Application Support", "org.python"))
elif sys.platform == 'win32':
if os.environ.has_key('APPDATA'):
listdir = os.path.join(os.environ['APPDATA'], 'Python')
elif os.environ.has_key('USERPROFILE'):
listdir = os.path.join(os.environ['USERPROFILE'], 'Application Data', 'Python')
elif os.environ.has_key('HOMEDIR') and os.environ.has_key('HOMEPATH'):
listdir = os.path.join(os.environ['HOMEDIR'], os.environ['HOMEPATH'], 'Python')
else:
listdir = os.path.join(os.path.expanduser(""), 'Python')
else:
# pretty much has to be unix
listdir = os.path.expanduser(os.path.join("~", ".python"))
- Previous message: [Python-Dev] Reminder: last alphas next Wednesday 07-May-2008
- Next message: [Python-Dev] Reminder: last alphas next Wednesday 07-May-2008
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]