mirror of
https://github.com/rclone/rclone
synced 2025-08-20 16:01:45 +02:00
.github
backend
alias
all
amazonclouddrive
azureblob
b2
box
cache
chunker
combine
compress
crypt
drive
dropbox
fichier
filefabric
ftp
googlecloudstorage
googlephotos
hasher
hdfs
hidrive
http
internetarchive
jottacloud
koofr
local
about_unix.go
about_windows.go
fadvise_other.go
fadvise_unix.go
lchtimes.go
lchtimes_unix.go
local.go
local_internal_test.go
local_test.go
metadata.go
metadata_bsd.go
metadata_linux.go
metadata_other.go
metadata_unix.go
metadata_windows.go
read_device_other.go
read_device_unix.go
remove_other.go
remove_test.go
remove_windows.go
setbtime.go
setbtime_windows.go
symlink.go
symlink_other.go
tests_test.go
xattr.go
xattr_unsupported.go
mailru
mega
memory
netstorage
onedrive
opendrive
oracleobjectstorage
pcloud
pikpak
premiumizeme
putio
qingstor
s3
seafile
sftp
sharefile
sia
smb
storj
sugarsync
swift
union
uptobox
webdav
yandex
zoho
bin
cmd
cmdtest
contrib
docs
fs
fstest
graphics
lib
librclone
vfs
.gitattributes
.gitignore
.golangci.yml
CONTRIBUTING.md
COPYING
Dockerfile
MAINTAINERS.md
MANUAL.html
MANUAL.md
MANUAL.txt
Makefile
README.md
RELEASE.md
VERSION
go.mod
go.sum
notes.txt
rclone.1
rclone.go
40 lines
696 B
Go
40 lines
696 B
Go
//go:build windows
|
|
// +build windows
|
|
|
|
package local
|
|
|
|
import (
|
|
"os"
|
|
"syscall"
|
|
"time"
|
|
|
|
"github.com/rclone/rclone/fs"
|
|
)
|
|
|
|
const (
|
|
ERROR_SHARING_VIOLATION syscall.Errno = 32
|
|
)
|
|
|
|
// Removes name, retrying on a sharing violation
|
|
func remove(name string) (err error) {
|
|
const maxTries = 10
|
|
var sleepTime = 1 * time.Millisecond
|
|
for i := 0; i < maxTries; i++ {
|
|
err = os.Remove(name)
|
|
if err == nil {
|
|
break
|
|
}
|
|
pathErr, ok := err.(*os.PathError)
|
|
if !ok {
|
|
break
|
|
}
|
|
if pathErr.Err != ERROR_SHARING_VIOLATION {
|
|
break
|
|
}
|
|
fs.Logf(name, "Remove detected sharing violation - retry %d/%d sleeping %v", i+1, maxTries, sleepTime)
|
|
time.Sleep(sleepTime)
|
|
sleepTime <<= 1
|
|
}
|
|
return err
|
|
}
|