windows/distutils question

Paul Rubin http
Tue Jun 28 01:36:32 EDT 2005


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.



More information about the Python-list mailing list