fix removing build directory
This commit is contained in:
1 parent
3b0d5295d3
commit
8034eef8c7
2 files changed
+15
-1
No files matched your search
@@ -47,3 +47,15 @@ pub fn make_dir(l: &Lua, path: String) -> LuaResult<MultiValue> {
|
||||
Err(err) => Ok((Value::Nil, err.to_string()).into_lua_multi(l)?),
|
||||
}
|
||||
}
|
||||
|
||||
pub fn remove_dir(l: &Lua, (path, recursive): (String, Option<bool>)) -> LuaResult<MultiValue> {
|
||||
let result = if recursive.unwrap_or(false) {
|
||||
fs::remove_dir_all(&path)
|
||||
} else {
|
||||
fs::remove_dir(&path)
|
||||
};
|
||||
match result {
|
||||
Ok(_) => Ok(Value::Boolean(true).into_lua_multi(l)?),
|
||||
Err(err) => Ok((Value::Nil, err.to_string()).into_lua_multi(l)?),
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user