issue2699: restore symlinks on windows when run as admin user

This commit is contained in:
fgma
2022-10-29 21:19:33 +02:00
committed by Michael Eischer
parent f8910bc4ff
commit 8e5eb1090c
4 changed files with 14 additions and 6 deletions
+1 -1
View File
@@ -51,7 +51,7 @@ func Rename(oldpath, newpath string) error {
// Symlink creates newname as a symbolic link to oldname.
// If there is an error, it will be of type *LinkError.
func Symlink(oldname, newname string) error {
return os.Symlink(fixpath(oldname), fixpath(newname))
return os.Symlink(oldname, fixpath(newname))
}
// Link creates newname as a hard link to oldname.
-5
View File
@@ -14,7 +14,6 @@ import (
"github.com/restic/restic/internal/errors"
"bytes"
"runtime"
"github.com/restic/restic/internal/debug"
"github.com/restic/restic/internal/fs"
@@ -295,10 +294,6 @@ func (node Node) writeNodeContent(ctx context.Context, repo Repository, f *os.Fi
}
func (node Node) createSymlinkAt(path string) error {
// Windows does not allow non-admins to create soft links.
if runtime.GOOS == "windows" {
return nil
}
if err := os.Remove(path); err != nil && !errors.Is(err, os.ErrNotExist) {
return errors.Wrap(err, "Symlink")