/[thuban]/branches/WIP-pyshapelib-bramz/Thuban/Lib/fileutil.py
ViewVC logotype

Diff of /branches/WIP-pyshapelib-bramz/Thuban/Lib/fileutil.py

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1148 by frank, Wed Jun 11 10:45:18 2003 UTC revision 1188 by jonathan, Thu Jun 12 17:00:43 2003 UTC
# Line 153  def relative_filename_nt(dir, absname): Line 153  def relative_filename_nt(dir, absname):
153      return relative_filename_common(dir_rest, absname_rest, "\\")      return relative_filename_common(dir_rest, absname_rest, "\\")
154    
155  def get_application_dir():  def get_application_dir():
156      """Determine the path to the .thuban directory.      """Determine the path to the .thuban directory. Create the directory
157        if it doesn't exist.
158    
159      Under posix systems use the os.expanduser() method.      Under posix systems use the os.expanduser() method.
160      Under Win32 try to read the "Explorer/Shell Folders/" value "AppData".      Under Win32 try to read the "Explorer/Shell Folders/" value "AppData".
161      """      """
162    
163      if os.name == 'posix':      if os.name == 'posix':
164          return os.path.expanduser("~/.thuban")          dir = os.path.expanduser("~/.thuban")
165            if not os.path.isdir(dir):
166               os.mkdir(dir)
167            return dir
168      elif os.name == 'nt':      elif os.name == 'nt':
169          regkey = 1          regkey = 1
170          try:          try:
# Line 173  def get_application_dir(): Line 177  def get_application_dir():
177                  key = wreg.OpenKey(wreg.HKEY_CURRENT_USER,                  key = wreg.OpenKey(wreg.HKEY_CURRENT_USER,
178                    "Software\\Microsoft\\Windows\\CurrentVersion\\"\                    "Software\\Microsoft\\Windows\\CurrentVersion\\"\
179                    "Explorer\\Shell Folders")                    "Explorer\\Shell Folders")
180                    dir = wreg.QueryValueEx(key, "AppData")[0]
181                    dir = os.path.join(dir, "thuban")
182              except:              except:
183                  regkey = 0                  regkey = 0
184    
185          if regkey:          if not regkey:
             dir = wreg.QueryValueEx(key, "AppData")  
         else:  
186              # The fallback. This should result in something like the              # The fallback. This should result in something like the
187              # user directory ...              # user directory ...
188              guess = os.path.dirname(              guess = os.path.dirname(

Legend:
Removed from v.1148  
changed lines
  Added in v.1188

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26