diff options
| author | Michael Fraenkel <michael.fraenkel@gmail.com> | 2014-07-17 17:02:46 +1000 |
|---|---|---|
| committer | Alex Brainman <alex.brainman@gmail.com> | 2014-07-17 17:02:46 +1000 |
| commit | cf521ce64f50c4f300294d6b649f34eca87bb8a3 (patch) | |
| tree | a7f4a5612448eae5076254bd2c2193dc87727b34 /src/pkg/os/file_unix.go | |
| parent | 47fd6bd9b62c8c028f03fc9407e3ce261fb8ed6d (diff) | |
| download | go-git-cf521ce64f50c4f300294d6b649f34eca87bb8a3.tar.gz | |
os: Implement symlink support for Windows
Fixes #5750.
https://code.google.com/p/go/issues/detail?id=5750
os: Separate windows from posix. Implement windows support.
path/filepath: Use the same implementation as other platforms
syscall: Add/rework new APIs for Windows
LGTM=alex.brainman
R=golang-codereviews, alex.brainman, gobot, rsc, minux
CC=golang-codereviews
https://golang.org/cl/86160044
Diffstat (limited to 'src/pkg/os/file_unix.go')
| -rw-r--r-- | src/pkg/os/file_unix.go | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/src/pkg/os/file_unix.go b/src/pkg/os/file_unix.go index 23d5f65360..bba0d9c0f6 100644 --- a/src/pkg/os/file_unix.go +++ b/src/pkg/os/file_unix.go @@ -316,3 +316,23 @@ func TempDir() string { } return dir } + +// Link creates newname as a hard link to the oldname file. +// If there is an error, it will be of type *LinkError. +func Link(oldname, newname string) error { + e := syscall.Link(oldname, newname) + if e != nil { + return &LinkError{"link", oldname, newname, e} + } + return nil +} + +// 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 { + e := syscall.Symlink(oldname, newname) + if e != nil { + return &LinkError{"symlink", oldname, newname, e} + } + return nil +} |
