kopia lustrzana https://github.com/micropython/micropython-lib
os: Add getcwd().
rodzic
74cfa40c3a
commit
a55dc7e57b
|
@ -15,6 +15,7 @@ errno_ = libc.var("i", "errno")
|
|||
mkdir_ = libc.func("i", "mkdir", "si")
|
||||
unlink_ = libc.func("i", "unlink", "s")
|
||||
rmdir_ = libc.func("i", "rmdir", "s")
|
||||
getwd_ = libc.func("s", "getwd", "s")
|
||||
opendir_ = libc.func("P", "opendir", "s")
|
||||
readdir_ = libc.func("P", "readdir", "P")
|
||||
read_ = libc.func("i", "read", "ipi")
|
||||
|
@ -43,6 +44,10 @@ def raise_error():
|
|||
raise OSError(errno_.get())
|
||||
|
||||
|
||||
def getcwd():
|
||||
buf = bytearray(512)
|
||||
return getwd_(buf)
|
||||
|
||||
def mkdir(name, mode=0o777):
|
||||
e = mkdir_(name, mode)
|
||||
check_error(e)
|
||||
|
|
Ładowanie…
Reference in New Issue