diff options
| author | alex.boterolowry <alex.boterolowry@5914aa95-5b3a-0410-a3b5-7b719e7fe9b2> | 2009-11-13 23:25:02 +0000 |
|---|---|---|
| committer | alex.boterolowry <alex.boterolowry@5914aa95-5b3a-0410-a3b5-7b719e7fe9b2> | 2009-11-13 23:25:02 +0000 |
| commit | ff2404d1f0858b5ac281a7d7a5f7d15e4bcc9940 (patch) | |
| tree | 3543fb59644f17904889b5e1296ac82b454b0a44 /freebase/fcl | |
| parent | c98d5cdaca13de6a9f6c991b33f1e7fba4708db5 (diff) | |
way better .. support
git-svn-id: http://freebase-python.googlecode.com/svn/trunk@228 5914aa95-5b3a-0410-a3b5-7b719e7fe9b2
Diffstat (limited to 'freebase/fcl')
| -rwxr-xr-x | freebase/fcl/fcl.py | 22 |
1 files changed, 18 insertions, 4 deletions
diff --git a/freebase/fcl/fcl.py b/freebase/fcl/fcl.py index b62317d..3ba60d2 100755 --- a/freebase/fcl/fcl.py +++ b/freebase/fcl/fcl.py @@ -119,13 +119,27 @@ class FclCommandHandler(object): # raise CmdException("can't resolve relative id %r without cwid - see 'fcl help pwid'" % (path)) raise CmdException("no support for relative id %r" % (path)) - if path == '' or path == '.': + if path == '': return self.pwd - if path == '..': - return '/'.join(self.pwd.split('/')[:-1]) or '/' - return os.path.join(self.pwd, path) + if self.pwd == '/': + full = [''] + else: + full = self.pwd.split('/') + + for a in path.split('/'): + if a == '.' or '': + continue + if a == '..': + full.pop() + continue + + full.append(a) + + path = '/'.join(full) + + return path or '/' def absprop(self, propkey): |
