kopia lustrzana https://github.com/micropython/micropython-lib
os.path: Remove external / ffi dependencies in os.path.
This work was funded by Planet Innovation. Signed-off-by: Andrew Leech <andrew.leech@planetinnovation.com.au>pull/543/head
rodzic
d0f97fc218
commit
459e13921a
|
@ -1,4 +1,4 @@
|
||||||
metadata(version="0.1.3")
|
metadata(version="0.1.4")
|
||||||
|
|
||||||
# Originally written by Paul Sokolovsky.
|
# Originally written by Paul Sokolovsky.
|
||||||
|
|
||||||
|
|
|
@ -47,7 +47,11 @@ def basename(path):
|
||||||
|
|
||||||
|
|
||||||
def exists(path):
|
def exists(path):
|
||||||
return os.access(path, os.F_OK)
|
try:
|
||||||
|
os.stat(path)
|
||||||
|
return True
|
||||||
|
except OSError:
|
||||||
|
return False
|
||||||
|
|
||||||
|
|
||||||
# TODO
|
# TODO
|
||||||
|
@ -55,11 +59,9 @@ lexists = exists
|
||||||
|
|
||||||
|
|
||||||
def isdir(path):
|
def isdir(path):
|
||||||
import stat
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
mode = os.stat(path)[0]
|
mode = os.stat(path)[0]
|
||||||
return stat.S_ISDIR(mode)
|
return mode & 0o040000
|
||||||
except OSError:
|
except OSError:
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
|
Ładowanie…
Reference in New Issue