Last active
February 2, 2023 03:21
-
-
Save imba-tjd/63d80318404d751e47d3b9c9d796475e to your computer and use it in GitHub Desktop.
realpath.exe for windows
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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