~azzar1/unity/add-show-desktop-key

« back to all changes in this revision

Viewing changes to www/common/util.py

  • Committer: mattgiuca
  • Date: 2008-01-29 02:39:18 UTC
  • Revision ID: svn-v3-trunk0:2b9c9e99-6f39-0410-b283-7f802c844ae2:trunk:320
common/util.py: Fixed unmake_path so it works if the root directory is "/".
(logic error).

Show diffs side-by-side

added added

removed removed

Lines of Context:
52
52
    root = os.path.normpath(root_dir)
53
53
 
54
54
    if path.startswith(root):
55
 
        # +1 to take out the slash as well
56
 
        return path[len(root)+1:]
57
 
    else:
58
 
        return path
 
55
        path = path[len(root)+1:]
 
56
        # Take out the slash as well
 
57
        if path[0] == os.sep:
 
58
            path = path[1:]
 
59
 
 
60
    return path
59
61
 
60
62
def split_path(path):
61
63
    """Given a path, returns a tuple consisting of the top-level directory in