MCPcopy Create free account
hub / github.com/WasmVM/WasmVM / fs_mkdir

Function fs_mkdir

host/sysenv/sys_fs.cpp:227–239  ·  view source on GitHub ↗

mkdir(path_ptr, path_len, mode:i32) -> i32

Source from the content-addressed store, hash-verified

225
226// mkdir(path_ptr, path_len, mode:i32) -> i32
227static std::vector<Value> fs_mkdir(Stack& stack) {
228 Frame& frame = stack.frames.top();
229 i64_t path_ptr = get_ptr(frame.locals[0]);
230 i64_t path_len = get_ptr(frame.locals[1]);
231 i32_t mode = std::get<i32_t>(frame.locals[2]);
232 try {
233 std::string path = mem_string(stack, path_ptr, path_len);
234 if(sys_mkdir(path.c_str(), (int)mode) != 0) return {Value(err_code())};
235 return {Value(i32_t(0))};
236 } catch(...) {
237 return {Value(i32_t(-EFAULT))};
238 }
239}
240
241// rmdir(path_ptr, path_len) -> i32
242static std::vector<Value> fs_rmdir(Stack& stack) {

Callers

nothing calls this directly

Calls 5

get_ptrFunction · 0.85
mem_stringFunction · 0.85
sys_mkdirFunction · 0.85
ValueClass · 0.85
err_codeFunction · 0.85

Tested by

no test coverage detected