我们从Python开源项目中,提取了以下23个代码示例,用于说明如何使用nt._getfinalpathname()。
def resolve(self, path, strict=False): s = str(path) if not s: return os.getcwd() previous_s = None if _getfinalpathname is not None: if strict: return self._ext_to_normal(_getfinalpathname(s)) else: # End of the path after the first one not found tail_parts = [] while True: try: s = self._ext_to_normal(_getfinalpathname(s)) except FileNotFoundError: previous_s = s s, tail = os.path.split(s) tail_parts.append(tail) if previous_s == s: return path else: return os.path.join(s, *reversed(tail_parts)) # Means fallback on absolute return None
def _getfinalpathname(f): return normcase(abspath(f))
def resolve(self, path): s = str(path) if not s: return os.getcwd() if _getfinalpathname is not None: return self._ext_to_normal(_getfinalpathname(s)) # Means fallback on absolute return None
def samefile(f1, f2): "Test whether two pathnames reference the same actual file" return _getfinalpathname(f1) == _getfinalpathname(f2)