X-Git-Url: http://code.vuplus.com/gitweb/?p=vuplus_dvbapp;a=blobdiff_plain;f=lib%2Fpython%2FTools%2FDirectories.py;h=f0ef0de22a3dfd6acca870adc069d270b29c029d;hp=8e4d0044fc6043d4ef00f17e6ba15828cabd21f4;hb=3c919c91a7778a049bad0317f6f7df86ff509415;hpb=6bb0be9d2f3b9862bc35e08e5ab82870d98e6676 diff --git a/lib/python/Tools/Directories.py b/lib/python/Tools/Directories.py index 8e4d004..f0ef0de 100755 --- a/lib/python/Tools/Directories.py +++ b/lib/python/Tools/Directories.py @@ -118,7 +118,11 @@ def resolveFilename(scope, base = "", path_prefix = None): if flags == PATH_CREATE: if not pathExists(path): - mkdir(path) + try: + mkdir(path) + except OSError: + print "resolveFilename: Couldn't create %s" % path + return None fallbackPath = fallbackPaths.get(scope) @@ -224,12 +228,13 @@ def InitFallbackFiles(): # returns a list of tuples containing pathname and filename matching the given pattern # example-pattern: match all txt-files: ".*\.txt$" def crawlDirectory(directory, pattern): - expression = compile(pattern) list = [] - for root, dirs, files in walk(directory): - for file in files: - if expression.match(file) is not None: - list.append((root, file)) + if directory: + expression = compile(pattern) + for root, dirs, files in walk(directory): + for file in files: + if expression.match(file) is not None: + list.append((root, file)) return list def copyfile(src, dst):