From 84c7a33c40dcab7b674fd7367474ff5b5a3030a3 Mon Sep 17 00:00:00 2001 From: Yannick Ulrich Date: Sun, 12 Mar 2023 12:32:56 +0000 Subject: [PATCH] Added unmount function Designed by Arsen6331 --- fuse.go | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/fuse.go b/fuse.go index 83b4570..a5dea5b 100644 --- a/fuse.go +++ b/fuse.go @@ -11,7 +11,15 @@ import ( func startFUSE(ctx context.Context, dev *infinitime.Device) error { // This is where we'll mount the FS - os.Mkdir(k.String("fuse.mountpoint"), 0755) + err := os.MkdirAll(k.String("fuse.mountpoint"), 0755) + if err != nil && !os.IsExist(err) { + return err + } + + // Ignore the error because nothing might be mounted on the mountpoint + _ = fusefs.Unmount(k.String("fuse.mountpoint")) + + root, err := fusefs.BuildRootNode(dev) if err != nil { log.Error("Building root node failed").