Merge pull request #1658 from aarroyoc/copy_file
Add predicate file_copy/2 in library(files)
This commit is contained in:
@@ -1653,6 +1653,19 @@ impl Machine {
|
||||
self.machine_st.fail = true;
|
||||
}
|
||||
|
||||
#[inline(always)]
|
||||
pub(crate) fn file_copy(&mut self) {
|
||||
if let Some(file) = self.machine_st.value_to_str_like(self.machine_st.registers[1]) {
|
||||
if let Some(copied) = self.machine_st.value_to_str_like(self.machine_st.registers[2]) {
|
||||
if fs::copy(file.as_str(), copied.as_str()).is_ok() {
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
self.machine_st.fail = true;
|
||||
}
|
||||
|
||||
#[inline(always)]
|
||||
pub(crate) fn delete_directory(&mut self) {
|
||||
if let Some(dir) = self.machine_st.value_to_str_like(self.machine_st.registers[1]) {
|
||||
|
||||
Reference in New Issue
Block a user