Sets the leaf name of this path.
(&mut self, name: &str)
| 283 | |
| 284 | /// Sets the leaf name of this path. |
| 285 | fn set_leaf_name(&mut self, name: &str) { |
| 286 | if self.path.starts_with('/') { |
| 287 | self.path.clear(); |
| 288 | self.path.push('/'); |
| 289 | self.path.push_str(name); |
| 290 | } else { |
| 291 | self.path.clear(); |
| 292 | self.path.push_str(name); |
| 293 | } |
| 294 | } |
| 295 | |
| 296 | /// Sets the file name extension as long as this location corresponds to a file and not a |
| 297 | /// directory and does not already have one. |