2016-11-24 12:07:14 +00:00
|
|
|
// Copyright (C) 2016 The Syncthing Authors.
|
|
|
|
//
|
|
|
|
// This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
// License, v. 2.0. If a copy of the MPL was not distributed with this file,
|
2017-02-09 06:52:18 +00:00
|
|
|
// You can obtain one at https://mozilla.org/MPL/2.0/.
|
2016-11-24 12:07:14 +00:00
|
|
|
|
|
|
|
// +build !windows
|
|
|
|
|
|
|
|
package fs
|
|
|
|
|
|
|
|
import "os"
|
|
|
|
|
|
|
|
var symlinksSupported = true
|
|
|
|
|
|
|
|
func DisableSymlinks() {
|
|
|
|
symlinksSupported = false
|
|
|
|
}
|
|
|
|
|
|
|
|
func (BasicFilesystem) SymlinksSupported() bool {
|
|
|
|
return symlinksSupported
|
|
|
|
}
|
|
|
|
|
2017-02-07 08:34:24 +00:00
|
|
|
func (BasicFilesystem) CreateSymlink(name, target string) error {
|
2016-11-24 12:07:14 +00:00
|
|
|
return os.Symlink(target, name)
|
|
|
|
}
|
|
|
|
|
2017-02-07 08:34:24 +00:00
|
|
|
func (BasicFilesystem) ReadSymlink(path string) (string, error) {
|
|
|
|
return os.Readlink(path)
|
2016-11-24 12:07:14 +00:00
|
|
|
}
|