diff --git a/os.path/os/path.py b/os.path/os/path.py index a03cd04b..33e81e14 100644 --- a/os.path/os/path.py +++ b/os.path/os/path.py @@ -47,3 +47,13 @@ def isdir(path): return stat.S_ISDIR(mode) except OSError: return False + + +def expanduser(s): + if s == "~" or s.startswith("~/"): + h = os.getenv("HOME") + return h + s[1:] + if s[0] == "~": + # Sorry folks, follow conventions + return "/home/" + s[1:] + return s