This commit is contained in:
allexanderbergmns
2026-08-25 15:26:30 +02:00
parent 76e912c922
commit 4ccc8a0f95
16 changed files with 546 additions and 50 deletions
+12
View File
@@ -513,6 +513,10 @@ fn (mut v Vm) native(id int, _argc int) ! {
p := v.pop_str()!
v.push(v.enc_int(bool_i64(os.exists(p))))!
}
native_build_is_dir {
p := v.pop_str()!
v.push(v.enc_int(bool_i64(os.is_dir(p))))!
}
native_build_mkdir {
p := v.pop_str()!
os.mkdir_all(p) or { return error('build_mkdir: cannot create ${p}: ${err.msg()}') }
@@ -635,6 +639,14 @@ fn (mut v Vm) native(id int, _argc int) ! {
}
v.push(v.alloc_str(s.repeat(n)))!
}
native_cwd {
v.push(v.alloc_str(os.getwd()))!
}
native_json_pretty {
x := v.pop()!
s := v.json_pretty_value(x, 0) or { return error('json_pretty: ${err.msg()}') }
v.push(v.alloc_str(s))!
}
else {
return error('unknown native builtin ${id}')
}