Skip to content

Commit 6a5ec7d

Browse files
Fixes Issue 14 (#15)
* fix: use .exe suffix on windows executables during dep check * added: more informative win dependency problem logging
1 parent a6fcbd8 commit 6a5ec7d

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

main.go

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ import (
1414
"os/exec"
1515
"path/filepath"
1616
"regexp"
17+
"runtime"
1718
"strings"
1819
)
1920

@@ -30,6 +31,7 @@ func (e *DefaultExitor) Exit(code int) {
3031
}
3132

3233
const defaultPrompt = "Extract the most important keywords from this text and create a filename. The filename should be concise (max 64 chars), use only the most important keywords, and separate words with dashes. Do not include any explanations or additional text."
34+
const winErrPre = "On windows dependencies might be tricky. We recommend using a package manager like chocolatey, winget or similar\n\n"
3335

3436
// Config holds the application configuration
3537
type Config struct {
@@ -54,8 +56,17 @@ type OllamaResponse struct {
5456
func checkDependencies() error {
5557
deps := []string{"curl", "jq", "ollama", "gs", "ocrmypdf"} // Always include ocrmypdf
5658
for _, dep := range deps {
59+
if runtime.GOOS == "windows" {
60+
// On Windows, append .exe if necessary
61+
dep = dep + ".exe"
62+
}
63+
5764
if _, err := exec.LookPath(dep); err != nil {
58-
return fmt.Errorf("error: %s is not installed. Please install it first", dep)
65+
depErrMsg := "error: %s is not installed. Please install it first"
66+
if runtime.GOOS == "windows" {
67+
depErrMsg = winErrPre + depErrMsg
68+
}
69+
return fmt.Errorf(depErrMsg, dep)
5970
}
6071
}
6172

0 commit comments

Comments
 (0)