Skip to content

Commit 207d43b

Browse files
committed
fix issuses with rclone on windows
1 parent 9f9a85d commit 207d43b

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

pkg/rclone/client.go

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import (
44
"fmt"
55
"os"
66
"os/exec"
7+
"runtime"
78
"strconv"
89
"time"
910

@@ -52,9 +53,14 @@ func (m *Manager) mountWithRetry(mountPath, provider, webdavURL string, maxRetri
5253
func (m *Manager) performMount(mountPath, provider, webdavURL string) error {
5354
cfg := config.Get()
5455

55-
// Create mount directory
56-
if err := os.MkdirAll(mountPath, 0755); err != nil {
57-
return fmt.Errorf("failed to create mount directory %s: %w", mountPath, err)
56+
// Create mount directory(except on Windows, cos winFSP handles it)
57+
if runtime.GOOS != "windows" {
58+
if err := os.MkdirAll(mountPath, 0755); err != nil {
59+
return fmt.Errorf("failed to create mount directory %s: %w", mountPath, err)
60+
}
61+
} else {
62+
// In fact, delete the mount if it exists, to avoid issues
63+
_ = os.Remove(mountPath) // Ignore error
5864
}
5965

6066
// Check if already mounted

0 commit comments

Comments
 (0)