hara_native/runtime/
filesystem_mount.rs1use super::filesystem_runtime::FilesystemRuntimeAdapter;
2use super::{SessionKernel, SessionMountId};
3use crate::filesystem::FilesystemHandle;
4use std::rc::Rc;
5
6impl SessionKernel {
7 pub fn create_provider_filesystem(&mut self, handle: FilesystemHandle) -> SessionMountId {
11 let descriptor = handle.descriptor();
12 let kind = stable_provider_kind(descriptor.kind());
13 let display = descriptor.display().to_owned();
14 self.create_filesystem(
15 Rc::new(FilesystemRuntimeAdapter::new(handle)),
16 kind,
17 &display,
18 )
19 }
20}
21
22fn stable_provider_kind(kind: &str) -> &'static str {
23 match kind {
24 "native" => "native",
25 "memory" => "memory",
26 "indexeddb" => "indexeddb",
27 "sftp" => "sftp",
28 "github" => "github",
29 "google-drive" => "google-drive",
30 "s3" => "s3",
31 "webdav" => "webdav",
32 _ => "provider",
33 }
34}