diff --git a/.gitignore b/.gitignore index 5f4ebb8..b883f1f 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1 @@ -main.exe +*.exe diff --git a/go.mod b/go.mod index 9a9693e..f001325 100644 --- a/go.mod +++ b/go.mod @@ -1,3 +1,3 @@ -module main +module fmoditer go 1.22.4 diff --git a/main.go b/main.go index 5259d3e..9fbea78 100644 --- a/main.go +++ b/main.go @@ -91,9 +91,18 @@ func main() { } func DoesFileExist(input string) bool { + if input == "" { + return false + } file, err := os.Open(input) if err != nil { - return false + if os.IsNotExist(err) { + return false + } else { + log.Printf("Error checking if file exists: %s", err) + file.Close() + return true + } } file.Close() return true