Update install.go

This commit is contained in:
W192547975
2023-12-30 16:10:17 +08:00
committed by GitHub
parent 3102089590
commit 7f737bd925

View File

@@ -37,7 +37,7 @@ func install() {
parseParams("install")
targetPath := filepath.Join(defaultInstallPath, defaultBinName)
d := daemon{}
binPath, _ := os.Executable()
binPath, _ := os.Executable() // can not use args[0], on Windows call openp2p is ok(=openp2p.exe)
if targetPath != binPath {
// copy files
errFiles := copyFile(targetPath, binPath)
@@ -63,7 +63,7 @@ func install() {
}
func copyFile(dst, src string) error {
srcF, err := os.Open(src) // can not use args[0], on Windows call openp2p is ok(=openp2p.exe)
srcF, err := os.Open(src)
if err != nil {
return fmt.Errorf("os.Open %s error: %w", src, err)
}