Skip to content

Commit

Permalink
fix: cannot run path relative executable errors on Windows
Browse files Browse the repository at this point in the history
  • Loading branch information
garethgeorge committed Jul 11, 2024
1 parent 4d0d13e commit c3ec9ee
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions internal/resticinstaller/resticinstaller.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import (
"io"
"net/http"
"os"
"os/exec"
"path"
"runtime"
"strings"
Expand Down Expand Up @@ -237,11 +238,8 @@ func FindOrInstallResticBinary() (string, error) {

// Search the PATH for the specific restic version.
resticBinName := resticBinName()
for _, dir := range strings.Split(os.Getenv("PATH"), string(os.PathListSeparator)) {
candidatePath := path.Join(dir, resticBinName)
if _, err := os.Stat(candidatePath); err == nil {
return candidatePath, nil
}
if binPath, err := exec.LookPath(resticBinName); err == nil {
return binPath, nil
}

// Check for restic installation in data directory.
Expand Down

0 comments on commit c3ec9ee

Please sign in to comment.