os: Add chdir(), rename().

pull/118/head^2
Paul Sokolovsky 2014-07-05 02:42:11 +03:00
rodzic 4e3154ba21
commit 27da05f2ac
3 zmienionych plików z 12 dodań i 2 usunięć

Wyświetl plik

@ -1,5 +1,5 @@
srctype = micropython-lib
type = package
version = 0.1.3
version = 0.1.4
author = Paul Sokolovsky
depends = libc

Wyświetl plik

@ -13,7 +13,9 @@ except:
libc = _libc.get()
errno_ = libc.var("i", "errno")
chdir_ = libc.func("i", "chdir", "s")
mkdir_ = libc.func("i", "mkdir", "si")
rename_ = libc.func("i", "rename", "ss")
unlink_ = libc.func("i", "unlink", "s")
rmdir_ = libc.func("i", "rmdir", "s")
getwd_ = libc.func("s", "getwd", "s")
@ -60,6 +62,10 @@ def mkdir(name, mode=0o777):
e = mkdir_(name, mode)
check_error(e)
def rename(old, new):
e = rename_(old, new)
check_error(e)
def unlink(name):
e = unlink_(name)
check_error(e)
@ -145,6 +151,10 @@ def close(fd):
def access(path, mode):
return access_(path, mode) == 0
def chdir(dir):
r = chdir_(dir)
check_error(r)
def fork():
r = fork_()
check_error(r)

Wyświetl plik

@ -6,7 +6,7 @@ from setuptools import setup
setup(name='micropython-os',
version='0.1.3',
version='0.1.4',
description='os module for MicroPython',
long_description="This is a module reimplemented specifically for MicroPython standard library,\nwith efficient and lean design in mind. Note that this module is likely work\nin progress and likely supports just a subset of CPython's corresponding\nmodule. Please help with the development if you are interested in this\nmodule.",
url='https://github.com/micropython/micropython/issues/405',