Show
Ignore:
Timestamp:
03/02/08 21:31:45 (10 months ago)
Author:
KRKeegan <-NOSPAM-kevin@krkeegan.com>
git-committer:
KRKeegan <-NOSPAM-kevin@krkeegan.com> 1204515105 -0800
git-parent:

[48e5447199435cb9695489516056d65842b74acc]

git-author:
KRKeegan <-NOSPAM-kevin@krkeegan.com> 1204515105 -0800
Message:

Add exception catch to all os.listdir commands

Otherwise we risk choking on folders that we don't have permission to view.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • plugins/photo/photo.py

    r6989290 r3f7f64b  
    332332            files = [] 
    333333            path = unicode(path, 'utf-8') 
    334             for f in os.listdir(path): 
    335                 f = os.path.join(path, f) 
    336                 isdir = os.path.isdir(f) 
    337                 f = f.encode('utf-8') 
    338                 if recurse and isdir: 
    339                     files.extend(build_recursive_list(f)) 
    340                 else: 
    341                    if isdir or filterFunction(f): 
    342                        files.append(FileData(f, isdir)) 
     334            try: 
     335                for f in os.listdir(path): 
     336                    f = os.path.join(path, f) 
     337                    isdir = os.path.isdir(f) 
     338                    f = f.encode('utf-8') 
     339                    if recurse and isdir: 
     340                        files.extend(build_recursive_list(f)) 
     341                    else: 
     342                       if isdir or filterFunction(f): 
     343                           files.append(FileData(f, isdir)) 
     344            except: 
     345                pass 
    343346 
    344347            return files