windows/distutils question

P

Paul Rubin

I'm trying to package a windows app with distutils (you've heard about
it before). The app needs to store some data on disk and apparently
the right place to put it is in the "Application Data" directory. The
only way I see to find out the name of this directory is the
get_special_folder_path function in the postinstallation script
(CSIDL_APPDATA). So I call that function and get the directory name,
which work ok.

There's just one problem: how do I store the name so the application
can use it? My obvious idea is to just make an "appdir.py" file
containing something like

# automatically generated by postinstallation script
application_directory = "C:\windows\documents and settings\username\application data"

but the point is that I need appdir.py to be stored in the directory
where the application code itself lives, i.e. the installation target
directory. And I don't see a way to find THAT from the
postinstallation script. The postinstallation script seems to run
with working directory equal to wherever you launched it from.

Note: using os.path.expanduser('~/Application Data') doesn't work
because the person may be using a non-English version of Windows and
that directory would have a different name.

Thanks for any ideas.
 
P

pyguy2

If the environment variable:

os.environ['APPDATA']

is present on non-English Windows, you may be able to use that to get
what you need.

john
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,756
Messages
2,569,534
Members
45,007
Latest member
OrderFitnessKetoCapsules

Latest Threads

Top