Show
Ignore:
Timestamp:
20/11/06 00:00:19 (6 years ago)
Author:
andy
Message:

Fix bug #33 "Backing up homedir to homedir causes infinite loop" and bug #34 "Can't backup broken symlinks"

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • trunk/src/pybackpack/gui.py

    r45 r47  
    521521                                for dirname, dirs, files in os.walk(path): 
    522522                                        for file in files: 
    523                                                 buf.insert(buf.get_end_iter(), "   %s" % os.path.join(dirname,file)) 
    524                                                 if os.access(os.path.join(dirname,file), os.R_OK): 
     523                                                fullpath = os.path.join(dirname,file) 
     524                                                buf.insert(buf.get_end_iter(), "   %s" % fullpath) 
     525                                                # We might be backing up a broken symlink, but who cares, we're not following them 
     526                                                if os.path.islink(fullpath): 
    525527                                                        filecount += 1 
    526                                                         buf.insert(buf.get_end_iter(), " [OK]\n") 
     528                                                        # buf.insert(buf.get_end_iter(), " [OK:SYM]\n") 
     529                                                elif os.access(fullpath, os.R_OK): 
     530                                                        filecount += 1 
     531                                                        # buf.insert(buf.get_end_iter(), " [OK]\n") 
    527532                                                else: 
    528                                                         problems.append((os.path.join(dirname,file), "File")) 
    529                                                         buf.insert(buf.get_end_iter(), " [ERR]\n") 
     533                                                        problems.append((fullpath, "File")) 
     534                                                        # buf.insert(buf.get_end_iter(), " [ERR]\n") 
    530535                                        for dir in dirs: 
    531                                                 if os.access(os.path.join(dirname,dir), os.R_OK|os.X_OK): 
     536                                                fullpath = os.path.join(dirname,dir) 
     537                                                if os.access(fullpath, os.R_OK|os.X_OK): 
    532538                                                        filecount += 1 
    533539                                                else: 
    534                                                         problems.append((os.path.join(dirname,dir),"Directory")) 
     540                                                        problems.append((fullpath,"Directory")) 
    535541                        elif os.access(path, os.R_OK): 
    536542                                filecount += 1