-
Notifications
You must be signed in to change notification settings - Fork 29
fix(mount): mount button disabled incorrectly on macOS when directory exists (#109) #110
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change | ||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
@@ -204,14 +204,29 @@ 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 | ||||||||||||||||
Comment on lines
+209
to
+210
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The hardcoded index
Suggested change
Copilot uses AI. Check for mistakes. Positive FeedbackNegative Feedback |
||||||||||||||||
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<String> = vec![ | ||||||||||||||||
"mount".into(), | ||||||||||||||||
"--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" | ||||||||||||||||
} | ||||||||||||||||
} | ||||||||||||||||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The comment assumes mount point is always the second argument, but this may not be accurate for all rclone mount command variations. Consider validating that the argument is actually a mount point path or documenting the specific expected command format.
Copilot uses AI. Check for mistakes.