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.
|
||||
|
||||
|
|
|
@ -47,7 +47,11 @@ def basename(path):
|
|||
|
||||
|
||||
def exists(path):
|
||||
return os.access(path, os.F_OK)
|
||||
try:
|
||||
os.stat(path)
|
||||
return True
|
||||
except OSError:
|
||||
return False
|
||||
|
||||
|
||||
# TODO
|
||||
|
@ -55,11 +59,9 @@ lexists = exists
|
|||
|
||||
|
||||
def isdir(path):
|
||||
import stat
|
||||
|
||||
try:
|
||||
mode = os.stat(path)[0]
|
||||
return stat.S_ISDIR(mode)
|
||||
return mode & 0o040000
|
||||
except OSError:
|
||||
return False
|
||||
|
||||
|
|
Ładowanie…
Reference in New Issue