mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
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
This commit is contained in:
parent
47fd6bd9b6
commit
cf521ce64f
18 changed files with 404 additions and 73 deletions
|
|
@ -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
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue