summaryrefslogtreecommitdiff
path: root/freebase/fcl
diff options
context:
space:
mode:
Diffstat (limited to 'freebase/fcl')
-rwxr-xr-xfreebase/fcl/fcl.py22
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):