From 6eed5106f890682a4156332a0a866bb281bc7dfb Mon Sep 17 00:00:00 2001 From: Quinten Date: Tue, 30 Jan 2024 15:17:53 +0100 Subject: [PATCH] check if the ini file can be found, else error --- main.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/main.go b/main.go index 23f8477..37d8fcd 100644 --- a/main.go +++ b/main.go @@ -47,6 +47,12 @@ func main() { return } + // Check if the INI file exists + if _, err := os.Stat(iniFilePath); os.IsNotExist(err) { + fmt.Printf("INI file not found, Exiting") + return + } + // Read the contents of the original INI file iniContent, err := ioutil.ReadFile(iniFilePath) if err != nil {