1
0
Fork 0
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:
klauspost 2015-08-13 14:13:40 +02:00
parent cc805b9325
commit 8d419713de

View file

@ -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")