def Auto(): def rootDirPath(): if sys.platform == 'win32': # Windows if os.environ.get('SystemDrive'): result = os.environ.get('SystemDrive') else: # if cannot get result = 'C:\\' else: # UNIX & MacOS result = '/' return result def homeDirPath(): if os.environ.get('HOME'): result = os.environ.get('HOME') else: if sys.platform == 'win32': # Windows if os.environ.get('USERPROFILE'): result = os.environ.get('USERPROFILE') elif os.environ.get('HOMEDRIVE') & os.environ.get('HOMEPATH'): result = os.environ.get('HOMEDRIVE') + os.environ.get('HOMEPATH') else: result = rootDirPath else: # UNIX & MacOS result = rootDirPath() return result if os.environ.get('PSIDATADIR'): profDir = os.environ.get('PSIDATADIR') + os.sep + 'profiles' + os.sep else: if sys.platform == 'win32': # Windows if homeDirPath == rootDirPath(): # Windows 9x profDir = '.' else: profDir = homeDirPath() profDir += '\\PsiData\\profiles\\' else: # UNIX & MacOS profDir = homeDirPath() + '/.psi/profiles/' if os.path.exists(profDir) & os.path.isdir(profDir): names = os.listdir(profDir) if len(names) > 0: for name in names: if os.path.isdir(profDir + name) & os.path.exists(profDir + name + os.sep + 'config.xml'): print 'Profile: ' + name ParseXML(profDir + name + os.sep + 'config.xml') print else: print 'Profiles not found' else: print 'Psi IM data not found'