Distinguish between symlinks and ntfs junctions.
This commit is contained in:
parent
cb84774231
commit
7f2360d1c0
1 changed files with 11 additions and 0 deletions
|
@ -357,8 +357,19 @@ class Path:
|
||||||
def is_file(self):
|
def is_file(self):
|
||||||
return os.path.isfile(self)
|
return os.path.isfile(self)
|
||||||
|
|
||||||
|
@property
|
||||||
|
def is_junction(self):
|
||||||
|
try:
|
||||||
|
return bool(os.readlink(self))
|
||||||
|
except (FileNotFoundError, OSError):
|
||||||
|
return False
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def is_link(self):
|
def is_link(self):
|
||||||
|
return self.is_symlink or self.is_junction
|
||||||
|
|
||||||
|
@property
|
||||||
|
def is_symlink(self):
|
||||||
return os.path.islink(self)
|
return os.path.islink(self)
|
||||||
|
|
||||||
def join(self, subpath, **spawn_kwargs):
|
def join(self, subpath, **spawn_kwargs):
|
||||||
|
|
Loading…
Reference in a new issue