mirror of https://github.com/perkeep/perkeep.git
pkg/fs: osxfuse version check shouldn't depend on map ordering
also, use fuse.OSXFUSELocationV3 and V2 for path info they're exported for this sort of thing Change-Id: If94024b944c419ced8760d904f521201916a5359
This commit is contained in:
parent
6d8d5f08bc
commit
4bfbdc7d51
|
@ -36,6 +36,7 @@ import (
|
||||||
"testing"
|
"testing"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
"bazil.org/fuse"
|
||||||
"bazil.org/fuse/syscallx"
|
"bazil.org/fuse/syscallx"
|
||||||
"camlistore.org/pkg/test"
|
"camlistore.org/pkg/test"
|
||||||
)
|
)
|
||||||
|
@ -52,26 +53,27 @@ func condSkip(t *testing.T) {
|
||||||
t.Skipf("Skipping test on OS %q", runtime.GOOS)
|
t.Skipf("Skipping test on OS %q", runtime.GOOS)
|
||||||
}
|
}
|
||||||
if runtime.GOOS == "darwin" {
|
if runtime.GOOS == "darwin" {
|
||||||
// The first path is osxfuse 3.x, the second is 2.x.
|
|
||||||
// TODO: simplify if/when bazil drops 2.x support.
|
// TODO: simplify if/when bazil drops 2.x support.
|
||||||
osxFusePathToMarkers := map[string]string{
|
_, err := os.Stat(fuse.OSXFUSELocationV3.Mount)
|
||||||
"/Library/Filesystems/osxfuse.fs/Contents/Resources/mount_osxfuse": "cammount@osxfuse",
|
|
||||||
"/Library/Filesystems/osxfusefs.fs/Support/mount_osxfusefs": "mount_osxfusefs@",
|
|
||||||
}
|
|
||||||
for path, marker := range osxFusePathToMarkers {
|
|
||||||
_, err := os.Stat(path)
|
|
||||||
if err == nil {
|
if err == nil {
|
||||||
osxFuseMarker = marker
|
osxFuseMarker = "cammount@osxfuse"
|
||||||
break
|
return
|
||||||
}
|
}
|
||||||
if !os.IsNotExist(err) {
|
if !os.IsNotExist(err) {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
|
_, err = os.Stat(fuse.OSXFUSELocationV2.Mount)
|
||||||
|
if err == nil {
|
||||||
|
osxFuseMarker = "mount_osxfusefs@"
|
||||||
|
// TODO(mpl): add a similar check/warning to pkg/fs or cammount.
|
||||||
|
t.Log("OSXFUSE version 2.x detected. Please consider upgrading to v 3.x.")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if !os.IsNotExist(err) {
|
||||||
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
if osxFuseMarker == "" {
|
|
||||||
test.DependencyErrorOrSkip(t)
|
test.DependencyErrorOrSkip(t)
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
type mountEnv struct {
|
type mountEnv struct {
|
||||||
|
|
Loading…
Reference in New Issue