On 25/11/2013 20:48, Eamonn Rea wrote:
I've heard that there is a library that allows you to get the appdata directory 
for a given OS, but I'd like to do it myself, as a learning experience.

Is there a built in way to get a users Appdata Directory? For example on OS X 
it's in '~/Library//Application Support/'. I can get the OS just fine 
(sys.platform and then storing it in my own way; example: darwin = OS X, just 
for my own readability), and I can get the home directory just fine 
(expanduser), but I have no idea how to get the appdata directory.

One way I could think of doing it would be to just detect the os and join the 
string on like so (completely untested, but an idea);

if os == 'OS X':
     appdata_dir = os.path.join(home_dir, '/Application Support/')

But then that arises the problem of cross platform compatibility.

So is here a good, cross platform solution to this problem?

Take a look here http://docs.python.org/3/library/os.html#process-parameters, specifically os.environ.


Also, what is PEP, PEP8, etc? Is it like the Python programming layout 
conventions? Is there more to it than that?

PEP stands for Python Enhancement Proposal, please see http://www.python.org/dev/peps/ PEP8 is the style guide for Python code.

--
Python is the second best programming language in the world.
But the best has yet to be invented.  Christian Tismer

Mark Lawrence

--
https://mail.python.org/mailman/listinfo/python-list

Reply via email to