diff --git a/src-tauri/Cargo.lock b/src-tauri/Cargo.lock index 3f071ba..9ba00d8 100644 --- a/src-tauri/Cargo.lock +++ b/src-tauri/Cargo.lock @@ -2940,7 +2940,7 @@ dependencies = [ [[package]] name = "openlist-desktop" -version = "0.6.1" +version = "0.7.0" dependencies = [ "anyhow", "base64 0.22.1", diff --git a/src-tauri/src/cmd/rclone_mount.rs b/src-tauri/src/cmd/rclone_mount.rs index 19b9289..0b78622 100644 --- a/src-tauri/src/cmd/rclone_mount.rs +++ b/src-tauri/src/cmd/rclone_mount.rs @@ -204,6 +204,21 @@ pub async fn create_rclone_mount_remote_process( let rclone_conf_path = get_rclone_config_path().map_err(|e| format!("Failed to get rclone config path: {e}"))?; + // Extract mount point from args and create directory if it doesn't exist + let args_vec = split_args_vec(config.args.clone()); + if args_vec.len() >= 2 { + let mount_point = &args_vec[1]; // Mount point is typically the second argument + let mount_path = Path::new(mount_point); + if !mount_path.exists() { + if let Err(e) = fs::create_dir_all(mount_path) { + return Err(format!( + "Failed to create mount point directory '{}': {}", + mount_point, e + )); + } + } + } + let api_key = get_api_key(); let port = get_server_port(); let mut args: Vec = vec![ @@ -211,7 +226,7 @@ pub async fn create_rclone_mount_remote_process( "--config".into(), rclone_conf_path.to_string_lossy().into_owned(), ]; - args.extend(split_args_vec(config.args.clone())); + args.extend(args_vec); let config = ProcessConfig { id: config.id.clone(), @@ -311,9 +326,9 @@ pub async fn get_mount_info_list( Ok(is_mounted) => { if process.is_running { if is_mounted { "mounted" } else { "mounting" } - } else if is_mounted { - "unmounting" } else { + // If process is not running, the mount point should be considered unmounted + // regardless of whether the directory exists or not "unmounted" } }