Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
aooohan committed May 10, 2024
1 parent 5854d7a commit 5643fac
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions internal/util/file.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ package util
import (
"io"
"os"
"os/exec"
"path/filepath"
"runtime"
"strings"
Expand Down Expand Up @@ -114,3 +115,15 @@ func IsExecutable(src string) bool {
return info.Mode()&0111 != 0
}
}

// MkSymlink Create a symbolic link
func MkSymlink(oldname, newname string) (err error) {
if runtime.GOOS == "windows" {
// Create a symbolic link on Windows
// https://superuser.com/questions/1020821/how-can-i-create-a-symbolic-link-on-windows-10
if err = exec.Command("cmd", "/c", "mklink", "/j", newname, oldname).Run(); err == nil {
return nil
}
}
return os.Symlink(oldname, newname)
}

0 comments on commit 5643fac

Please sign in to comment.