1
0
mirror of https://github.com/vlang/v.git synced 2023-08-10 21:13:21 +03:00

os: add an optional "mode" parameter to os.mkdir and os.mkdir_all (#14887)

This commit is contained in:
Markus F.X.J. Oberhumer
2022-06-30 12:49:47 +02:00
committed by GitHub
parent 7c3571b274
commit 74bb5ae17a
8 changed files with 16 additions and 12 deletions

View File

@@ -296,7 +296,7 @@ pub fn is_dir(path string) bool {
*/
// mkdir creates a new directory with the specified path.
pub fn mkdir(path string) ?bool {
pub fn mkdir(path string, params MkdirParams) ?bool {
if path == '.' {
return true
}
@@ -313,7 +313,7 @@ pub fn mkdir(path string) ?bool {
/*
$if linux {
$if !android {
ret := C.syscall(sys_mkdir, apath.str, 511)
ret := C.syscall(sys_mkdir, apath.str, params.mode)
if ret == -1 {
return error(posix_get_error_msg(C.errno))
}
@@ -321,7 +321,7 @@ pub fn mkdir(path string) ?bool {
}
}
*/
r := unsafe { C.mkdir(&char(apath.str), 511) }
r := unsafe { C.mkdir(&char(apath.str), params.mode) }
if r == -1 {
return error(posix_get_error_msg(C.errno))
}