Skip to content

Instantly share code, notes, and snippets.

@imba-tjd
Last active February 2, 2023 03:21
Show Gist options
  • Save imba-tjd/63d80318404d751e47d3b9c9d796475e to your computer and use it in GitHub Desktop.
Save imba-tjd/63d80318404d751e47d3b9c9d796475e to your computer and use it in GitHub Desktop.
realpath.exe for windows
// Git for Windows or git-bash contains a realpath.exe which is required by git code.editor
// However I'm using Git distribution from VS, which doesn't have it.
// Copying from Git for Windows isn't a good choice because it needs msys-2.0.dll
// This program offers similar function, which is enough for me.
// It won't resolve '~'. It works when path contains whitespaces.
package main
import (
"fmt"
"os"
"path/filepath"
)
func main() {
for _, p := range os.Args[1:] {
rp, err := filepath.Abs(p)
if err != nil {
panic(err)
}
fmt.Println(rp)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment