En Thu, 01 May 2008 10:30:03 -0300, Nick Craig-Wood <[EMAIL PROTECTED]> escribió:

As for where to store it, I use os.path.expanduser("~") to find the
base directory and a bit of platform specific code.

Something like this snippet

    self.is_windows = sys.platform == 'win32'
    self.home = os.path.expanduser("~")
    if self.is_windows:
self.config_dir = os.path.join(self.home, "Application Data", self.NAME)
    else:
        self.config_dir = os.path.join(self.home, "."+self.NAME)
    if not os.path.isdir(self.config_dir):
        os.makedirs(self.config_dir, mode=0700)
    self.config_file = os.path.join(self.config_dir, "config")

Please don't do that if you distribute your programs. "Application Data" is a localized name, like "Program Files" and all special folders. On my Spanish version of Windows, they're "Datos de programa" y "Archivos de Programa" respectively, and the user may choose to move them to another location. Use SHGetFolderPath to obtain the path; see http://msdn.microsoft.com/en-us/library/bb762181(VS.85).aspx

--
Gabriel Genellina

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

Reply via email to