summaryrefslogtreecommitdiffstats
path: root/Lib/macpath.py
diff options
context:
space:
mode:
Diffstat (limited to 'Lib/macpath.py')
-rw-r--r--Lib/macpath.py14
1 files changed, 13 insertions, 1 deletions
diff --git a/Lib/macpath.py b/Lib/macpath.py
index 1d3fa56..bca410e 100644
--- a/Lib/macpath.py
+++ b/Lib/macpath.py
@@ -150,7 +150,7 @@ def getctime(filename):
return os.stat(filename).st_ctime
def exists(s):
- """Return True if the pathname refers to an existing file or directory."""
+ """Test whether a path exists. Returns False for broken symbolic links"""
try:
st = os.stat(s)
@@ -158,6 +158,18 @@ def exists(s):
return False
return True
+# Is `stat`/`lstat` a meaningful difference on the Mac? This is safe in any
+# case.
+
+def lexists(path):
+ """Test whether a path exists. Returns True for broken symbolic links"""
+
+ try:
+ st = os.lstat(path)
+ except os.error:
+ return False
+ return True
+
# Return the longest prefix of all list elements.
def commonprefix(m):