Canonicalize
(path: &str)
| 108 | |
| 109 | // Canonicalize |
| 110 | pub fn canon(path: &str) -> Result<String, ()> |
| 111 | { |
| 112 | match crate::sys::proc::env("HOME") |
| 113 | { |
| 114 | Some(home) => |
| 115 | { |
| 116 | if path.starts_with('~') |
| 117 | { |
| 118 | Ok(path.replace('~', &home)) |
| 119 | } |
| 120 | else |
| 121 | { |
| 122 | Ok(path.to_string()) |
| 123 | } |
| 124 | }, |
| 125 | |
| 126 | None => |
| 127 | { |
| 128 | Ok(path.to_string()) |
| 129 | } |
| 130 | } |
| 131 | } |
| 132 | |
| 133 | |
| 134 | // Create a new device |