示例#1
0
 def rootpath(self, truepath, binds=True):
     truepath = PATHPARTS.path_2_tuple(truepath)
     if binds:
         entries = self._entries_by_root
     else:
         entries = self._entries_by_root_nobinds
     for x in range(len(truepath), 1, -1):
         parts = truepath[:x]
         if parts in entries:
             return PATHPARTS.path_2_string(parts)
     return PATHPARTS.path_2_string(truepath[:1])
示例#2
0
 def truepath(self, path):
     try:
         path = PATH.realpath(path)
         parts = PATHPARTS.path_2_tuple(path)
         for x in range(len(parts), 0, -1):
             part = parts[:x]
             if part in self._binds:
                 parts = self._binds[part] + parts[x:]
                 path = PATHPARTS.path_2_string(parts)
                 return path
         return path
     except OSError, ex:
         return None