Fix common cwd segment for absolute paths

This commit is contained in:
Kim Silkebækken 2013-01-22 14:09:02 +01:00
parent c5df2fcb7c
commit 35de8a192b
1 changed files with 4 additions and 0 deletions

View File

@ -83,7 +83,11 @@ def cwd(dir_shorten_len=None, dir_limit_depth=None):
cwd_split.insert(0, u'')
cwd = [i[0:dir_shorten_len] if dir_shorten_len and i else i for i in cwd_split[:-1]] + [cwd_split[-1]]
ret = []
if not cwd[0]:
cwd[0] = '/'
for part in cwd:
if not part:
continue
ret.append({
'contents': part,
})