From e5023474030c74bd788e39d0c4c47b8a8b260991 Mon Sep 17 00:00:00 2001 From: JustMichael Date: Wed, 17 Jan 2024 03:35:44 +0000 Subject: [PATCH] chore: added extra checks for compiler path --- compiler/compiler.go | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/compiler/compiler.go b/compiler/compiler.go index b1e871c1..22822417 100644 --- a/compiler/compiler.go +++ b/compiler/compiler.go @@ -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: "",