()
| 427 | } |
| 428 | |
| 429 | func initCustomShellStartupFilesInternal() error { |
| 430 | log.Printf("initializing wsh and shell startup files\n") |
| 431 | waveDataHome := wavebase.GetWaveDataDir() |
| 432 | binDir := filepath.Join(waveDataHome, WaveHomeBinDir) |
| 433 | err := InitRcFiles(waveDataHome, binDir) |
| 434 | if err != nil { |
| 435 | return err |
| 436 | } |
| 437 | |
| 438 | err = wavebase.CacheEnsureDir(binDir, WaveHomeBinDir, 0755, WaveHomeBinDir) |
| 439 | if err != nil { |
| 440 | return err |
| 441 | } |
| 442 | |
| 443 | // copy the correct binary to bin |
| 444 | wshFullPath, err := GetLocalWshBinaryPath(wavebase.WaveVersion, runtime.GOOS, runtime.GOARCH) |
| 445 | if err != nil { |
| 446 | log.Printf("error (non-fatal), could not resolve wsh binary path: %v\n", err) |
| 447 | } |
| 448 | if _, err := os.Stat(wshFullPath); err != nil { |
| 449 | log.Printf("error (non-fatal), could not resolve wsh binary %q: %v\n", wshFullPath, err) |
| 450 | return nil |
| 451 | } |
| 452 | wshDstPath := filepath.Join(binDir, "wsh") |
| 453 | if runtime.GOOS == "windows" { |
| 454 | wshDstPath = wshDstPath + ".exe" |
| 455 | } |
| 456 | err = utilfn.AtomicRenameCopy(wshDstPath, wshFullPath, 0755) |
| 457 | if err != nil { |
| 458 | return fmt.Errorf("error copying wsh binary to bin: %v", err) |
| 459 | } |
| 460 | wshBaseName := filepath.Base(wshFullPath) |
| 461 | log.Printf("wsh binary successfully copied from %q to %q\n", wshBaseName, wshDstPath) |
| 462 | return nil |
| 463 | } |
| 464 | |
| 465 | func GetShellTypeFromShellPath(shellPath string) string { |
| 466 | shellBase := filepath.Base(shellPath) |
no test coverage detected