Skip to content

Commit

Permalink
chore: added extra checks for compiler path
Browse files Browse the repository at this point in the history
  • Loading branch information
ADRFranklin committed Jan 17, 2024
1 parent e80b46d commit e502347
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions compiler/compiler.go
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,20 @@ func PrepareCommand(
} else {
compilerPath = path.Join(config.Compiler.Path, "pawncc")
}
if compilerPath == "" {
err = errors.New("compiler path is empty due to unknown os")
return
}

compilerPathStat, error := os.Stat(compilerPath)
if error != nil {
err = errors.Wrap(error, "compiler path is not invalid")
return
}
if !compilerPathStat.Mode().IsRegular() {
err = errors.New("compiler path does not contain a valid pawn compiler executable")
return
}

pkg = download.Compiler{
Match: "",
Expand Down

0 comments on commit e502347

Please sign in to comment.