def find_profiles_path(): """Find the path containing Firefox profiles. The location of Firefox profiles is OS dependent. This function handles the differences. """ path = None if platform.system() == 'Darwin': from Carbon import Folder, Folders pathref = Folder.FSFindFolder(Folders.kUserDomain, Folders.kApplicationSupportFolderType, Folders.kDontCreateFolder) basepath = pathref.FSRefMakePath() path = pycompat.bytestr(os.path.join(basepath, 'Firefox')) elif platform.system() == 'Windows': # From http://msdn.microsoft.com/en-us/library/windows/desktop/bb762494%28v=vs.85%29.aspx CSIDL_APPDATA = 26 path = pycompat.bytestr(win_get_folder_path(CSIDL_APPDATA)) if path: path = os.path.join(path, b'Mozilla', b'Firefox') else: # Assume POSIX # Pretty simple in comparison, eh? path = pycompat.bytestr(os.path.expanduser('~/.mozilla/firefox')) # This is a backdoor to facilitate testing, since find_profiles_path() # doesn't need to be run-time configurable. path = pycompat.bytestr(os.environ.get('FIREFOX_PROFILES_DIR', path)) return path
def findPreferencesDir(appname): """ Typical app preference directories are: Windows: C:\Documents and Settings\<username>\Application Data\<owner>\<appname> Mac OS X: ~/Library/Preferences/<appname> Unix: ~/.<lowercased-appname> """ platform = getPlatform() if platform == 'win': try: path = os.environ['appdata'] path = os.path.join(path, appname) except KeyError: path = None elif platform == 'darwin' or platform == 'mac': try: from Carbon import Folder, Folders path = Folder.FSFindFolder(Folders.kUserDomain, Folders.kPreferencesFolderType, Folders.kDontCreateFolder) path = os.path.join(path.FSRefMakePath(), appname) except ImportError: path = os.path.expanduser("~/Library/Preferences/" + appname) else: path = os.path.expanduser("~/." + appname.lower()) return path
def _candidate_tempdir_list(): """Generate a list of candidate temporary directories which _get_default_tempdir will try.""" dirlist = [] # First, try the environment. for envname in 'TMPDIR', 'TEMP', 'TMP': dirname = _os.getenv(envname) if dirname: dirlist.append(dirname) # Failing that, try OS-specific locations. if _os.name == 'mac': try: fsr = _Folder.FSFindFolder(_Folders.kOnSystemDisk, _Folders.kTemporaryFolderType, 1) dirname = fsr.as_pathname() dirlist.append(dirname) except _Folder.error: pass elif _os.name == 'riscos': dirname = _os.getenv('Wimp$ScrapDir') if dirname: dirlist.append(dirname) elif _os.name == 'nt': dirlist.extend([r'c:\temp', r'c:\tmp', r'\temp', r'\tmp']) else: dirlist.extend(['/tmp', '/var/tmp', '/usr/tmp']) # As a last resort, the current directory. try: dirlist.append(_os.getcwd()) except (AttributeError, _os.error): dirlist.append(_os.curdir) return dirlist
def user_data_dir(appname, appauthor=None, version=None, roaming=False): r"""Return full path to the user-specific data dir for this application. "appname" is the name of application. "appauthor" (only required and used on Windows) is the name of the appauthor or distributing body for this application. Typically it is the owning company name. "version" is an optional version path element to append to the path. You might want to use this if you want multiple versions of your app to be able to run independently. If used, this would typically be "<major>.<minor>". "roaming" (boolean, default False) can be set True to use the Windows roaming appdata directory. That means that for users on a Windows network setup for roaming profiles, this user data will be sync'd on login. See <http://technet.microsoft.com/en-us/library/cc766489(WS.10).aspx> for a discussion of issues. Typical user data directories are: Mac OS X: ~/Library/Application Support/<AppName> Unix: ~/.<appname> Win XP (not roaming): C:\Documents and Settings\<username>\Application Data\<AppAuthor>\<AppName> Win XP (roaming): C:\Documents and Settings\<username>\Local Settings\Application Data\<AppAuthor>\<AppName> Vista (not roaming): C:\Users\<username>\AppData\Local\<AppAuthor>\<AppName> Vista (roaming): C:\Users\<username>\AppData\Roaming\<AppAuthor>\<AppName> OPINION: For Unix there is no *real* standard here. For example, Firefox uses: "~/.mozilla/firefox" which is a "~/.<appauthor>/<appname>"-type scheme. As well, if you only have a single config file for your app, then something like "~/.pypirc" or "~/.hgrc" is fairly common. """ if sys.platform.startswith("win"): if appauthor is None: raise AppDirsError("must specify 'appauthor' on Windows") const = roaming and "CSIDL_APPDATA" or "CSIDL_LOCAL_APPDATA" path = os.path.join(_get_win_folder(const), appauthor, appname) elif sys.platform == 'darwin': if os.uname()[-1] == 'i386': # Folder.FSFindFolder() **used to fail** with error -43 # on x86. See Komodo bug 42669. #TODO: Update this to try FSFindFolder and fallback to this # hardcoding for the specific failure mode. basepath = os.path.expanduser('~/Library/Application Support') else: from Carbon import Folder, Folders path = Folder.FSFindFolder(Folders.kUserDomain, Folders.kApplicationSupportFolderType, Folders.kDontCreateFolder) basepath = path.FSRefMakePath() path = os.path.join(basepath, appname) else: path = os.path.expanduser("~/." + appname.lower()) if version: path = os.path.join(path, version) return path
def GetPrefs(prefname, creator='Pyth'): import macostools, os if _prefscache.has_key(prefname): return _prefscache[prefname] # Find the preferences folder and our prefs file, create if needed. fsr = Folder.FSFindFolder(Folders.kOnSystemDisk, 'pref', 1) prefsfolder = fsr.as_pathname() path = os.path.join(prefsfolder, prefname) head, tail = os.path.split(path) # make sure the folder(s) exist macostools.mkdirs(head) preffile = PrefFile(path, creator) _prefscache[prefname] = preffile return preffile
def getUserDocumentsPath(): """ Find the user's "Documents" directory (OS X), "My Documents" directory (Windows), or home directory (Unix). """ # OS X and Windows code from: # http://www.blueskyonmars.com/2005/08/05 # /finding-a-users-my-documents-folder-on-windows/ # Alternate Windows code from: # http://bugs.python.org/issue1763 if sys.platform.startswith('win'): if sys.platform.startswith('win32'): # Try the primary method on 32-bit windows try: from win32com.shell import shell alt = False except ImportError: try: import ctypes dll = ctypes.windll.shell32 alt = True except: raise Exception("Could not find 'My Documents'") else: # Use the alternate method on 64-bit Windows alt = True if not alt: # Primary method using win32com df = shell.SHGetDesktopFolder() pidl = df.ParseDisplayName(0, None, "::{450d8fba-ad25-11d0-98a8-0800361b1103}")[1] path = shell.SHGetPathFromIDList(pidl) else: # Alternate method using ctypes rather than win32com buf = ctypes.create_string_buffer(300) dll.SHGetSpecialFolderPathA(None, buf, 0x0005, False) path = buf.value elif sys.platform.startswith('darwin'): from Carbon import Folder, Folders folderref = Folder.FSFindFolder(Folders.kUserDomain, Folders.kDocumentsFolderType, False) path = folderref.as_pathname() else: path = os.getenv('HOME') return path
def MapDir(self, code): if sys.platform[:3] == "win": try: from ctypes import WinDLL, create_unicode_buffer dll = WinDLL('shell32') result = create_unicode_buffer(260) resource = dll.SHGetFolderPathW(None, code, None, 0, result) if resource != 0: raise Exception else: path = result.value except: if code == 0: path = os.environ['HOMEPATH'] else: raise elif sys.platform[:6] == "darwin": try: from Carbon import Folder, Folders folderref = Folder.FSFindFolder(Folders.kUserDomain, getattr(Folders, code), False) path = folderref.as_pathname() except: if code == 'kCurrentUserFolderType': path = os.environ['HOME'] else: raise else: try: XDG_USER_DIR_CMD = 'xdg-user-dir' import subprocess p = subprocess.Popen([XDG_USER_DIR_CMD, code], stdout=subprocess.PIPE) path, _ = p.communicate() path = path.rstrip('\n') except: if code == 'HOME': path = os.environ['HOME'] elif G.application.snap and code == 'DESKTOP': path = os.environ.get('XDG_DESKTOP_DIR') if not path: raise Exception elif G.application.snap and code == 'DOCUMENTS': path = os.environ.get('XDG_DOCUMENTS_DIR') if not path: raise Exception return Path(path).abspath()
def user_data_dir(appname, owner=None, version=None, csidl=None): """Return full path to the user-specific data dir for this application. "appname" is the name of application. "owner" (only required and used on Windows) is the name of the owner or distributing body for this application. Typically it is the owning company name. "version" is an optional version path element to append to the path. You might want to use this if you want multiple versions of your app to be able to run independently. If used, this would typically be "<major>.<minor>". "csidl" is an optional special folder to use - only applies to Windows. Typical user data directories are: Win XP: C:\Documents and Settings\USER\Application Data\<owner>\<appname> Mac OS X: ~/Library/Application Support/<appname> Unix: ~/.<lowercased-appname> From Windows Vista and onwards, the user data directory was split into the local app data directory and the roaming app data directory. Komodo 6 uses the local one for it's user data directory - Komodo 5 used the roaming one. For Unix there is no *real* standard here. For example, Firefox uses: "~/.mozilla/firefox" which is a "~/.<owner>/<appname>"-type scheme. """ if sys.platform.startswith("win"): if owner is None: raise Error("must specify 'owner' on Windows") path = os.path.join(_get_win_folder(csidl or "CSIDL_LOCAL_APPDATA"), owner, appname) elif sys.platform == 'darwin': if os.uname()[-1] == 'i386': #XXX Folder.FSFindFolder() fails with error -43 on x86. See 42669. basepath = os.path.expanduser('~/Library/Application Support') else: from Carbon import Folder, Folders path = Folder.FSFindFolder(Folders.kUserDomain, Folders.kApplicationSupportFolderType, Folders.kDontCreateFolder) basepath = path.FSRefMakePath() path = os.path.join(basepath, appname) else: path = os.path.expanduser("~/." + appname.lower()) if version: path = os.path.join(path, version) return path
def user_data_dir(appname, vendor, version=None): """Return full path to the user-specific data dir for this application. "appname" is the name of application. "vendor" (only required and used on Windows) is the name of the owner or distributing body for this application. Typically it is the owning company name. "version" is an optional version path element to append to the path. You might want to use this if you want multiple versions of your app to be able to run independently. If used, this would typically be "<major>.<minor>". Typical user data directories are: Windows: C:\Documents and Settings\USER\Application Data\<owner>\<appname> Mac OS X: ~/Library/Application Support/<appname> Unix: ~/.cache/<lowercased-appname> """ path = None if sys.platform.startswith('win'): appdata = os.environ.get('APPDATA') if appdata: appdata = appdata.decode(sys.getfilesystemencoding()) appdata = appdata.encode('utf-8') path = os.path.join(appdata, vendor, appname) elif sys.platform == 'darwin': try: from Carbon import Folder, Folders path = Folder.FSFindFolder(Folders.kUserDomain, Folders.kApplicationSupportFolderType, Folders.kDontCreateFolder) path = os.path.join(path.FSRefMakePath(), appname) except (ImportError, AttributeError): pass if not path: path = os.environ.get('XDG_CACHE_HOME') if path: path = os.path.normpath(path) else: path = os.path.expanduser('~/.cache') path = os.path.join(path, appname.lower()) path = path.decode(sys.getfilesystemencoding()).encode('utf-8') if version: path = os.path.join(path, '-' + version) return path
def site_data_dir(appname, appauthor=None, version=None): """Return full path to the user-shared data dir for this application. "appname" is the name of application. "appauthor" (only required and used on Windows) is the name of the appauthor or distributing body for this application. Typically it is the owning company name. "version" is an optional version path element to append to the path. You might want to use this if you want multiple versions of your app to be able to run independently. If used, this would typically be "<major>.<minor>". Typical user data directories are: Mac OS X: /Library/Application Support/<AppName> Unix: /etc/<appname> Win XP: C:\Documents and Settings\All Users\Application Data\<AppAuthor>\<AppName> Vista: (Fail! "C:\ProgramData" is a hidden *system* directory on Vista.) Win 7: C:\ProgramData\<AppAuthor>\<AppName> # Hidden, but writeable on Win 7. WARNING: Do not use this on Windows. See the Vista-Fail note above for why. """ if sys.platform.startswith("win"): if appauthor is None: raise AppDirsError("must specify 'appauthor' on Windows") path = os.path.join(_get_win_folder("CSIDL_COMMON_APPDATA"), appauthor, appname) elif sys.platform == 'darwin': if os.uname()[-1] == 'i386': # Folder.FSFindFolder() **used to fail** with error -43 # on x86. See Komodo bug 42669. #TODO: Update this to try FSFindFolder and fallback to this # hardcoding for the specific failure mode. basepath = os.path.expanduser('/Library/Application Support') else: from Carbon import Folder, Folders path = Folder.FSFindFolder(Folders.kLocalDomain, Folders.kApplicationSupportFolderType, Folders.kDontCreateFolder) basepath = os.path.join(path.FSRefMakePath(), appname) path = os.path.join(basepath, appname) else: path = "/etc/" + appname.lower() if version: path = os.path.join(path, version) return path
def _candidate_tempdir_list(): dirlist = [] for envname in ('TMPDIR', 'TEMP', 'TMP'): dirname = _os.getenv(envname) if dirname: dirlist.append(dirname) continue if _os.name == 'mac': try: fsr = _Folder.FSFindFolder(_Folders.kOnSystemDisk, _Folders.kTemporaryFolderType, 1) dirname = fsr.as_pathname() dirlist.append(dirname) except _Folder.error: pass if _os.name == 'riscos': dirname = _os.getenv('Wimp$ScrapDir') if dirname: dirlist.append(dirname) elif _os.name == 'nt': dirlist.extend([ 'c:\\temp', 'c:\\tmp', '\\temp', '\\tmp']) else: dirlist.extend([ '/tmp', '/var/tmp', '/usr/tmp']) try: dirlist.append(_os.getcwd()) except (AttributeError, _os.error): dirlist.append(_os.curdir) return dirlist
def user_cache_dir(appname, owner=None, version=None): """Return full path to the user-specific cache dir for this application. "appname" is the name of application. "owner" (only required and used on Windows) is the name of the owner or distributing body for this application. Typically it is the owning company name. "version" is an optional version path element to append to the path. You might want to use this if you want multiple versions of your app to be able to run independently. If used, this would typically be "<major>.<minor>". Typical user cache directories are: Win XP: C:\Documents and Settings\USER\Local Settings\Application Data\<owner>\<appname> Mac OS X: ~/Library/Caches/<appname> Unix: ~/.<lowercased-appname>/caches For Unix there is no *real* standard here. Note that we are returning the *same dir as the user_data_dir()* for Unix. Use accordingly. """ if sys.platform.startswith("win"): if owner is None: raise Error("must specify 'owner' on Windows") path = os.path.join(_get_win_folder("CSIDL_LOCAL_APPDATA"), owner, appname) elif sys.platform == 'darwin': if os.uname()[-1] == 'i386': #XXX Folder.FSFindFolder() fails with error -43 on x86. See 42669. basepath = os.path.expanduser('~/Library/Caches') else: from Carbon import Folder, Folders path = Folder.FSFindFolder(Folders.kUserDomain, Folders.kCachedDataFolderType, Folders.kDontCreateFolder) basepath = path.FSRefMakePath() path = os.path.join(basepath, appname) else: path = os.path.expanduser("~/.%s/caches" % appname.lower()) if version: path = os.path.join(path, version) return path
def get_mydocuments_dir(): if sys.platform in ['darwin', 'mac']: from Carbon import Folder, Folders folderref = Folder.FSFindFolder(Folders.kUserDomain, Folders.kDocumentsFolderType, False) mydocs = folderref.as_pathname() elif 'win' in sys.platform: from win32com.shell import shell df = shell.SHGetDesktopFolder() pidl = df.ParseDisplayName( 0, None, "::{450d8fba-ad25-11d0-98a8-0800361b1103}")[1] mydocs = shell.SHGetPathFromIDList(pidl) elif 'linux' in sys.platform: mydocs = '~/Desktop' else: mydocs = os.path.abspath('.') #cur dir return mydocs
def site_data_dir(appname, owner=None, version=None): """Return full path to the user-shared data dir for this application. "appname" is the name of application. "owner" (only required and used on Windows) is the name of the owner or distributing body for this application. Typically it is the owning company name. "version" is an optional version path element to append to the path. You might want to use this if you want multiple versions of your app to be able to run independently. If used, this would typically be "<major>.<minor>". Typical user data directories are: Windows: C:\Documents and Settings\All Users\Application Data\<owner>\<appname> Mac OS X: /Library/Application Support/<appname> Unix: /etc/<lowercased-appname> """ if sys.platform.startswith("win"): # Try to make this a unicode path because SHGetFolderPath does # not return unicode strings when there is unicode data in the # path. if owner is None: raise Error("must specify 'owner' on Windows") from win32com.shell import shellcon, shell shellcon.CSIDL_COMMON_APPDATA = 0x23 # missing from shellcon path = shell.SHGetFolderPath(0, shellcon.CSIDL_COMMON_APPDATA, 0, 0) path = os.path.join(path, owner, appname) elif sys.platform == 'darwin': from Carbon import Folder, Folders path = Folder.FSFindFolder(Folders.kLocalDomain, Folders.kApplicationSupportFolderType, Folders.kDontCreateFolder) path = os.path.join(path.FSRefMakePath(), appname) else: path = "/etc/" + appname.lower() if version: path = os.path.join(path, version) return path
def site_data_dir(appname, owner=None, version=None): """Return full path to the user-shared data dir for this application. "appname" is the name of application. "owner" (only required and used on Windows) is the name of the owner or distributing body for this application. Typically it is the owning company name. "version" is an optional version path element to append to the path. You might want to use this if you want multiple versions of your app to be able to run independently. If used, this would typically be "<major>.<minor>". Typical user data directories are: Win XP: C:\Documents and Settings\All Users\Application Data\<owner>\<appname> Mac OS X: /Library/Application Support/<appname> Unix: /etc/<lowercased-appname> """ if sys.platform.startswith("win"): if owner is None: raise Error("must specify 'owner' on Windows") path = os.path.join(_get_win_folder("CSIDL_COMMON_APPDATA"), owner, appname) elif sys.platform == 'darwin': if os.uname()[-1] == 'i386': # XXX Folder.FSFindFolder() fails with error -43 on x86. See 42669. basepath = os.path.expanduser('~/Library/Application Support') else: from Carbon import Folder, Folders path = Folder.FSFindFolder(Folders.kLocalDomain, Folders.kApplicationSupportFolderType, Folders.kDontCreateFolder) basepath = os.path.join(path.FSRefMakePath(), appname) path = os.path.join(basepath, appname) else: path = "/etc/"+appname.lower() if version: path = os.path.join(path, version) return path
def find_profiles(find_times=False): """Find Firefox profile directories. Returns an iterable of profile directories. The first entry is the active/default profile. """ base = None if platform.system() == 'Darwin': from Carbon import Folder, Folders pathref = Folder.FSFindFolder(Folders.kUserDomain, Folders.kApplicationSupportFolderType, Folders.kDontCreateFolder) path = pathref.FSRefMakePath() base = os.path.join(path, 'Firefox') elif platform.system() == 'Windows': import ctypes SHGetFolderPath = ctypes.windll.shell32.SHGetFolderPathW SHGetFolderPath.argtypes = [ctypes.c_void_p, ctypes.c_int, ctypes.c_void_p, ctypes.c_int32, ctypes.c_wchar_p] path_buf = ctypes.create_unicode_buffer(1024) CSIDL_APPDATA = 26 if not SHGetFolderPath(0, CSIDL_APPDATA, 0, 0, path_buf): path = path_buf.value base = os.path.join(path_buf.value, 'Mozilla', 'Firefox') else: base = os.path.expanduser('~/.mozilla/firefox') if not base: return [] ini_path = os.path.join(base, 'profiles.ini') c = RawConfigParser(allow_no_value=True) c.read([ini_path]) paths = [] for section in c.sections(): if not c.has_option(section, 'Path'): continue profile_path = c.get(section, 'Path') is_relative = True if c.has_option(section, 'IsRelative'): is_relative = c.getboolean(section, 'IsRelative') if is_relative: profile_path = os.path.join(base, profile_path) is_default = False if c.has_option(section, 'Default'): is_default = c.getboolean(section, 'Default') name = c.get(section, 'Name') newest_time = None if find_times: for f in os.listdir(profile_path): full = os.path.join(profile_path, f) if not os.path.isfile(full): continue mtime = os.path.getmtime(full) if not newest_time or mtime > newest_time: newest_time = mtime paths.append((name, profile_path, is_default, newest_time)) return paths
def user_cache_dir(appname, appauthor=None, version=None, opinion=True): r"""Return full path to the user-specific cache dir for this application. "appname" is the name of application. "appauthor" (only required and used on Windows) is the name of the appauthor or distributing body for this application. Typically it is the owning company name. "version" is an optional version path element to append to the path. You might want to use this if you want multiple versions of your app to be able to run independently. If used, this would typically be "<major>.<minor>". "opinion" (boolean) can be False to disable the appending of "[cC]ache" to the base app data dirs for Unix and Windows. See discussion below. Typical user cache directories are: Mac OS X: ~/Library/Caches/<AppName> Unix: ~/.<appname>/cache Win XP: C:\Documents and Settings\<username>\Local Settings\Application Data\<AppAuthor>\<AppName>\Cache Vista: C:\Users\<username>\AppData\Local\<AppAuthor>\<AppName>\Cache OPINION: For Unix there is no *real* standard here. This "cache" subdir is a suggestion from me. This can be disabled with the `opinion=False` option. On Windows the only suggestion in the MSDN docs is that local settings go in the `CSIDL_LOCAL_APPDATA` directory. This is identical to the non-roaming app data dir (the default returned by `user_data_dir` above). Apps typically put cache data somewhere *under* the given dir here. Some examples: ...\Mozilla\Firefox\Profiles\<ProfileName>\Cache ...\Acme\SuperApp\Cache\1.0 OPINION: This function appends "Cache" to the `CSIDL_LOCAL_APPDATA` value. This can be disabled with the `opinion=False` option. """ if sys.platform.startswith("win"): if appauthor is None: raise AppDirsError("must specify 'appauthor' on Windows") path = os.path.join(_get_win_folder("CSIDL_LOCAL_APPDATA"), appauthor, appname) if opinion: path = os.path.join(path, "Cache") elif sys.platform == 'darwin': if os.uname()[-1] == 'i386': # Folder.FSFindFolder() **used to fail** with error -43 # on x86. See Komodo bug 42669. #TODO: Update this to try FSFindFolder and fallback to this # hardcoding for the specific failure mode. basepath = os.path.expanduser('~/Library/Caches') else: from Carbon import Folder, Folders path = Folder.FSFindFolder(Folders.kUserDomain, Folders.kCachedDataFolderType, Folders.kDontCreateFolder) basepath = path.FSRefMakePath() path = os.path.join(basepath, appname) else: path = os.path.expanduser("~/.%s" % appname.lower()) if opinion: path = os.path.join(path, "cache") if version: path = os.path.join(path, version) return path
except ImportError: pass # Make sure fonts are found on Mac OS X if platform.system() == 'Darwin': fontPaths = [] try: from Carbon import File, Folder, Folders # @UnresolvedImport domains = [ Folders.kUserDomain, Folders.kLocalDomain, Folders.kSystemDomain ] if not runningFromSource: domains.append(Folders.kNetworkDomain) for domain in domains: try: fsref = Folder.FSFindFolder(domain, Folders.kFontsFolderType, False) fontPaths.append(File.pathname(fsref)) except: pass # Folder probably doesn't exist. except: fontPaths.extend([ os.path.expanduser('~/Library/Fonts'), '/Library/Fonts', '/Network/Library/Fonts', '/System/Library/Fonts' ]) os.environ['OSG_FILE_PATH'] = ':'.join(fontPaths) # Set up for internationalization. import gettext as gettext_module, __builtin__ __builtin__.gettext = gettext_module.translation('Neuroptikon', fallback=True).lgettext
if sys.platform == 'win32': document_folder = "c:/" try: document_folder = os.path.join( shell.SHGetFolderPath(0, shellcon.CSIDL_LOCAL_APPDATA, 0, 0), 'CCP', 'EVE', ) except Exception, e: print e pass elif sys.platform == 'darwin': from Carbon import Folder, Folders folderref = Folder.FSFindFolder(Folders.kUserDomain, Folders.kPreferencesFolderType, False) document_folder = os.path.join(folderref.as_pathname(), 'Eve Online Preferences', 'p_drive', 'My Documents', 'EVE', 'logs', 'MarketLogs') else: document_folder = '' # don't know what the linux client has document_folder = os.path.normpath(document_folder) # Now try to find the most relevant cache folder print "Starting to scan from ", document_folder rex = re.compile( 'cache/MachoNet/87\.237\.38\.200/([0-9]+)/CachedMethodCalls$') def walker(arg, dirname, fnames):