A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2008-May/079058.html below:

last alphas next Wednesday 07-May-2008

[Python-Dev] [Python-3000] Reminder: last alphas next Wednesday 07-May-2008Bill Janssen janssen at parc.com
Fri May 2 20:10:27 CEST 2008
> 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"))



More information about the Python-Dev mailing list

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4