Skip to content

Commit

Permalink
MacOS: rely on OSXFuse to create mountpoint below /Volumes
Browse files Browse the repository at this point in the history
OSXFuse automatically creates the mountpoint if it is
below /Volumes because this would require root permissions
which the user might not have.

Reported at #194
  • Loading branch information
rfjakob committed Jan 16, 2018
1 parent 025f33e commit 18e17b1
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
3 changes: 2 additions & 1 deletion checkdir.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ import (
"os"
)

// checkDirEmpty - check if "dir" exists and is an empty directory
// checkDirEmpty - check if "dir" exists and is an empty directory.
// Returns an *os.PathError if Stat() on the path fails.
func checkDirEmpty(dir string) error {
err := checkDir(dir)
if err != nil {
Expand Down
6 changes: 6 additions & 0 deletions mount.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,12 @@ func doMount(args *argContainer) int {
err = checkDir(args.mountpoint)
} else {
err = checkDirEmpty(args.mountpoint)
// OSXFuse will create the mountpoint for us if it is below /Volumes/
if runtime.GOOS == "darwin" && os.IsNotExist(err) && strings.HasPrefix(args.mountpoint, "/Volumes/") {
tlog.Info.Printf("Mountpoint %q does not exist, but should be created by OSXFuse",
args.mountpoint)
err = nil
}
}
if err != nil {
tlog.Fatal.Printf("Invalid mountpoint: %v", err)
Expand Down

0 comments on commit 18e17b1

Please sign in to comment.