cli/pkg/cmd/extension/symlink_windows.go
Mislav Marohnić bf9c49eccd Rename gh extensionsgh extension
This is for compatibility with other core commands which are all singular.
2021-08-11 22:22:39 +02:00

15 lines
443 B
Go

package extension
import "os"
func makeSymlink(oldname, newname string) error {
// Create a regular file that contains the location of the directory where to find this extension. We
// avoid relying on symlinks because creating them on Windows requires administrator privileges.
f, err := os.OpenFile(newname, os.O_WRONLY|os.O_CREATE, 0644)
if err != nil {
return err
}
defer f.Close()
_, err = f.WriteString(oldname)
return err
}