mirror of https://github.com/Hilbis/Hilbish
feat: add option for fs.mkdir to make recursive
parent
cd06c61195
commit
fb04322844
|
@ -47,9 +47,15 @@ func cd(L *lua.LState) int {
|
||||||
|
|
||||||
func mkdir(L *lua.LState) int {
|
func mkdir(L *lua.LState) int {
|
||||||
dirname := L.CheckString(1)
|
dirname := L.CheckString(1)
|
||||||
|
recursive := L.ToBool(2)
|
||||||
|
path := strings.TrimSpace(dirname)
|
||||||
|
|
||||||
// TODO: handle error here
|
// TODO: handle error here
|
||||||
os.Mkdir(strings.TrimSpace(dirname), 0744)
|
if recursive {
|
||||||
|
os.MkdirAll(path, 0744)
|
||||||
|
} else {
|
||||||
|
os.Mkdir(path, 0744)
|
||||||
|
}
|
||||||
|
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue