@@ -476,6 +476,33 @@ fn main() -> Result<()> {
476476 // Create symlink for cleaner access: filename.edited -> .filename.view/filename
477477 let symlink_path = parent. join ( format ! ( "{}.edited" , base_name) ) ;
478478
479+ // Clean up any stale mount point from a previous crashed session
480+ if mount_point. exists ( ) {
481+ // Try to unmount first (in case it's a stale FUSE mount)
482+ #[ cfg( target_os = "macos" ) ]
483+ {
484+ let _ = std:: process:: Command :: new ( "umount" )
485+ . arg ( & mount_point)
486+ . output ( ) ;
487+ // Also try diskutil unmount for macFUSE
488+ let _ = std:: process:: Command :: new ( "diskutil" )
489+ . args ( [ "unmount" , "force" ] )
490+ . arg ( & mount_point)
491+ . output ( ) ;
492+ }
493+ #[ cfg( target_os = "linux" ) ]
494+ {
495+ let _ = std:: process:: Command :: new ( "fusermount" )
496+ . args ( [ "-u" , "-z" ] ) // lazy unmount
497+ . arg ( & mount_point)
498+ . output ( ) ;
499+ }
500+ // Give it a moment to unmount
501+ std:: thread:: sleep ( std:: time:: Duration :: from_millis ( 100 ) ) ;
502+ // Now try to remove the directory
503+ let _ = std:: fs:: remove_dir ( & mount_point) ;
504+ }
505+
479506 std:: fs:: create_dir_all ( & mount_point) ?;
480507
481508 // Create symlink (remove if exists first)
@@ -503,6 +530,16 @@ fn main() -> Result<()> {
503530
504531 // Mount the filesystem (this blocks until unmounted)
505532 let fs = PatchedFileFS :: new ( state) ;
533+
534+ #[ cfg( target_os = "macos" ) ]
535+ let options = vec ! [
536+ MountOption :: RO ,
537+ MountOption :: FSName ( "bigedit" . to_string( ) ) ,
538+ MountOption :: CUSTOM ( "volname=bigedit" . to_string( ) ) ,
539+ MountOption :: CUSTOM ( "local" . to_string( ) ) ,
540+ ] ;
541+
542+ #[ cfg( not( target_os = "macos" ) ) ]
506543 let options = vec ! [
507544 MountOption :: RO ,
508545 MountOption :: FSName ( "bigedit" . to_string( ) ) ,
0 commit comments