diff --git a/os/os/__init__.py b/os/os/__init__.py index 8834b799..3df620b1 100644 --- a/os/os/__init__.py +++ b/os/os/__init__.py @@ -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) diff --git a/os/test_listdir.py b/os/test_dirs.py similarity index 100% rename from os/test_listdir.py rename to os/test_dirs.py