mirror of
https://github.com/sxyazi/yazi.git
synced 2026-07-25 08:41:05 +00:00
..
This commit is contained in:
parent
be3f2e6291
commit
ab094c2ae8
1 changed files with 0 additions and 15 deletions
|
|
@ -52,21 +52,6 @@ pub fn install(lua: &Lua) -> mlua::Result<()> {
|
||||||
}
|
}
|
||||||
})?,
|
})?,
|
||||||
),
|
),
|
||||||
(
|
|
||||||
"create",
|
|
||||||
lua.create_async_function(|lua, (type_, url): (mlua::String, UrlRef)| async move {
|
|
||||||
let result = match type_.to_str()? {
|
|
||||||
"file" => fs::File::create(&*url).await.map(|_| ()),
|
|
||||||
"dir" => fs::create_dir(&*url).await,
|
|
||||||
_ => Err("Creation type must be 'file', 'dir'".into_lua_err())?,
|
|
||||||
};
|
|
||||||
|
|
||||||
match result {
|
|
||||||
Ok(_) => (true, Value::Nil).into_lua_multi(lua),
|
|
||||||
Err(e) => (false, e.raw_os_error()).into_lua_multi(lua),
|
|
||||||
}
|
|
||||||
})?,
|
|
||||||
),
|
|
||||||
(
|
(
|
||||||
"read_dir",
|
"read_dir",
|
||||||
lua.create_async_function(|lua, (dir, options): (UrlRef, Table)| async move {
|
lua.create_async_function(|lua, (dir, options): (UrlRef, Table)| async move {
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue