def get_app_data_dir(): ''' Get application specific data dir @return: Application data directory ''' if sys.platform == 'win32': try: from win32com.shell.shell import SHGetFolderPath from win32com.shell.shellcon import CSIDL_APPDATA, CSIDL_COMMON_APPDATA app_data_dir = SHGetFolderPath(0, CSIDL_APPDATA, 0, 0) if not os.path.exists(app_data_dir): app_data_dir = SHGetFolderPath(0, CSIDL_COMMON_APPDATA, 0, 0) except ImportError, inst: app_data_dir = 'C:\\' return os.path.join(app_data_dir, APP_NAME)
def get_svn_config_dir(): """Return user's Subversion configuration directory.""" try: from win32com.shell.shell import SHGetFolderPath import win32com.shell.shellcon except ImportError: # If we can't import the win32api, just use ~; this is right on unix, and # returns not entirely unreasonable results on Windows. return os.path.expanduser('~/.subversion') # We're on Windows with win32api; use APPDATA. return os.path.join( SHGetFolderPath(0, win32com.shell.shellcon.CSIDL_APPDATA, 0, 0).encode('utf-8'), 'Subversion')