From 81d967b11d7ba19f2a84a42dbeeaaeb2ecbe0b75 Mon Sep 17 00:00:00 2001 From: "W. Trevor King" Date: Sun, 5 Sep 2010 18:14:18 -0400 Subject: [PATCH] Don't assume len(os.path.sep) == 1 in libbe.storage.vcs.base. --- libbe/storage/vcs/base.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/libbe/storage/vcs/base.py b/libbe/storage/vcs/base.py index ed72dd1..48bd034 100644 --- a/libbe/storage/vcs/base.py +++ b/libbe/storage/vcs/base.py @@ -224,7 +224,7 @@ class CachedPathID (object): continue try: id = self.id(dirpath) - relpath = dirpath[len(self._root)+1:] + relpath = dirpath[len(self._root + os.path.sep):] if id.count('/') == 0: if verbose == True and id in self._cache: print >> sys.stderr, 'Multiple paths for %s: \n %s\n %s' % (id, self._cache[id], relpath) @@ -313,15 +313,15 @@ class CachedPathID (object): path = os.path.join(self._root, path) if not path.startswith(self._root + os.path.sep): raise InvalidPath(path, self._root) - path = path[len(self._root)+1:] + path = path[len(self._root + os.path.sep):] orig_path = path if not path.startswith(self._spacer_dirs[0] + os.path.sep): raise InvalidPath(path, self._spacer_dirs[0]) for spacer in self._spacer_dirs: if not path.startswith(spacer + os.path.sep): break - id = path[len(spacer)+1:] - fields = path[len(spacer)+1:].split(os.path.sep,1) + id = path[len(spacer + os.path.sep):] + fields = path[len(spacer + os.path.sep):].split(os.path.sep,1) if len(fields) == 1: break path = fields[1] -- 2.26.2