ADDED: path_segments/2 for portable reasoning about path components.

The platform-specific directory separator is taken into account.
The clean representation of segments as a list simplifies reasoning.
This commit is contained in:
Markus Triska
2020-07-19 11:07:03 +02:00
parent bd0aa16322
commit 2768beec4c
3 changed files with 62 additions and 0 deletions

View File

@@ -870,6 +870,10 @@ impl MachineState {
return Ok(());
}
}
&SystemClauseType::DirectorySeparator => {
let addr = self.heap.put_constant(Constant::Char(std::path::MAIN_SEPARATOR));
self.unify(self[temp_v!(1)], addr);
}
&SystemClauseType::MakeDirectory => {
let directory = self.heap_pstr_iter(self[temp_v!(1)]).to_string();