symlink.go 658 B

123456789101112131415161718192021
  1. // Copyright (C) 2017 The Syncthing Authors.
  2. //
  3. // This Source Code Form is subject to the terms of the Mozilla Public
  4. // License, v. 2.0. If a copy of the MPL was not distributed with this file,
  5. // You can obtain one at https://mozilla.org/MPL/2.0/.
  6. // +build !windows
  7. package osutil
  8. import (
  9. "os"
  10. )
  11. // DebugSymlinkForTestsOnly is not and should not be used in Syncthing code,
  12. // hence the cumbersome name to make it obvious if this ever leaks. Its
  13. // reason for existence is the Windows version, which allows creating
  14. // symlinks when non-elevated.
  15. func DebugSymlinkForTestsOnly(oldname, newname string) error {
  16. return os.Symlink(oldname, newname)
  17. }