kopia lustrzana https://github.com/micropython/micropython-lib
os.path: Add expanduser().
rodzic
58e70ec733
commit
eb5556d346
|
@ -47,3 +47,13 @@ def isdir(path):
|
||||||
return stat.S_ISDIR(mode)
|
return stat.S_ISDIR(mode)
|
||||||
except OSError:
|
except OSError:
|
||||||
return False
|
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
|
||||||
|
|
Ładowanie…
Reference in New Issue