Add rename_file/2 predicate to the files library

This commit is contained in:
Paulo Moura
2021-05-18 18:08:30 +01:00
parent 0eeae24049
commit 58555d598b
3 changed files with 22 additions and 0 deletions

View File

@@ -900,6 +900,18 @@ impl MachineState {
}
}
}
&SystemClauseType::RenameFile => {
let file = self.heap_pstr_iter(self[temp_v!(1)]).to_string();
let renamed = self.heap_pstr_iter(self[temp_v!(2)]).to_string();
match fs::rename(file, renamed) {
Ok(_) => {}
_ => {
self.fail = true;
return Ok(());
}
}
}
&SystemClauseType::DeleteDirectory => {
let directory = self.heap_pstr_iter(self[temp_v!(1)]).to_string();