From ff2404d1f0858b5ac281a7d7a5f7d15e4bcc9940 Mon Sep 17 00:00:00 2001 From: "alex.boterolowry" Date: Fri, 13 Nov 2009 23:25:02 +0000 Subject: way better .. support git-svn-id: http://freebase-python.googlecode.com/svn/trunk@228 5914aa95-5b3a-0410-a3b5-7b719e7fe9b2 --- freebase/fcl/fcl.py | 22 ++++++++++++++++++---- 1 file 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): -- cgit v1.3.1