aboutsummaryrefslogtreecommitdiff
path: root/lib/python/Tools/Directories.py
diff options
context:
space:
mode:
authorAndreas Oberritter <obi@opendreambox.org>2011-03-25 19:58:57 +0100
committerAndreas Oberritter <obi@opendreambox.org>2011-03-29 15:43:58 +0200
commit2c5e4d6c412c1988b32cb7dbede988bc9dfb815d (patch)
treebee1e985d0b73ccd4ac6f541110bb9fea96969bf /lib/python/Tools/Directories.py
parent7f070068aa203cb95252b641b1c0cc5308a604ee (diff)
downloadenigma2-2c5e4d6c412c1988b32cb7dbede988bc9dfb815d.tar.gz
enigma2-2c5e4d6c412c1988b32cb7dbede988bc9dfb815d.zip
fix some crashes during settings wizard
Diffstat (limited to 'lib/python/Tools/Directories.py')
-rwxr-xr-xlib/python/Tools/Directories.py17
1 files changed, 11 insertions, 6 deletions
diff --git a/lib/python/Tools/Directories.py b/lib/python/Tools/Directories.py
index 8e4d0044..f0ef0de2 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):