Add delete_directory/1 predicate to the files library

This commit is contained in:
Paulo Moura
2021-05-18 08:41:19 +01:00
parent e7d6811948
commit eeac3bc436
3 changed files with 25 additions and 0 deletions

View File

@@ -889,6 +889,17 @@ impl MachineState {
}
}
}
&SystemClauseType::DeleteDirectory => {
let directory = self.heap_pstr_iter(self[temp_v!(1)]).to_string();
match fs::remove_dir(directory) {
Ok(_) => {}
_ => {
self.fail = true;
return Ok(());
}
}
}
&SystemClauseType::WorkingDirectory => {
if let Ok(dir) = env::current_dir() {
let current = match dir.to_str() {