mirror of
https://github.com/restic/restic.git
synced 2025-03-09 00:00:02 +01:00
Disable symlinks on Windows.
Windows cannot create symlinks without the user being administrator.
This commit is contained in:
parent
cc805b9325
commit
8d419713de
1 changed files with 5 additions and 0 deletions
5
node.go
5
node.go
|
@ -15,6 +15,7 @@ import (
|
|||
"github.com/restic/restic/debug"
|
||||
"github.com/restic/restic/pack"
|
||||
"github.com/restic/restic/repository"
|
||||
"runtime"
|
||||
)
|
||||
|
||||
// Node is a file, directory or other item in a backup.
|
||||
|
@ -236,6 +237,10 @@ func (node Node) createFileAt(path string, repo *repository.Repository) error {
|
|||
}
|
||||
|
||||
func (node Node) createSymlinkAt(path string) error {
|
||||
// Windows does not allow non-admins to create soft links.
|
||||
if runtime.GOOS == "windows" {
|
||||
return nil
|
||||
}
|
||||
err := os.Symlink(node.LinkTarget, path)
|
||||
if err != nil {
|
||||
return errors.Annotate(err, "Symlink")
|
||||
|
|
Loading…
Add table
Reference in a new issue