Resolves `username_path`, which must be of the form `user/path`, into an `AUTORUN` location.
(
console: Rc<RefCell<dyn Console>>,
storage: Rc<RefCell<Storage>>,
username_path: &str,
)
| 117 | |
| 118 | /// Resolves `username_path`, which must be of the form `user/path`, into an `AUTORUN` location. |
| 119 | pub fn mount_cloud_share( |
| 120 | console: Rc<RefCell<dyn Console>>, |
| 121 | storage: Rc<RefCell<Storage>>, |
| 122 | username_path: &str, |
| 123 | ) -> io::Result<String> { |
| 124 | let (fs_uri, path) = match username_path.split_once('/') { |
| 125 | Some((username, path)) => (format!("cloud://{}", username), format!("AUTORUN:/{}", path)), |
| 126 | None => { |
| 127 | return Err(io::Error::new( |
| 128 | io::ErrorKind::InvalidInput, |
| 129 | format!( |
| 130 | "Invalid program to run '{}'; must be of the form 'username/path'", |
| 131 | username_path |
| 132 | ), |
| 133 | )); |
| 134 | } |
| 135 | }; |
| 136 | |
| 137 | console.borrow_mut().print(&format!("Mounting {} as AUTORUN...", fs_uri))?; |
| 138 | storage.borrow_mut().mount("AUTORUN", &fs_uri)?; |
| 139 | storage.borrow_mut().cd("AUTORUN:/")?; |
| 140 | Ok(path) |
| 141 | } |
| 142 | |
| 143 | /// Loads the program given by `path` from storage and executes it on the `machine`. |
| 144 | pub async fn run_from_storage_path( |