fehlerbehebung

This commit is contained in:
xoy 2023-01-28 21:53:09 +01:00
parent 5ba64e7efb
commit 7eb828a6f2
1 changed files with 9 additions and 2 deletions

11
file.go
View File

@ -17,8 +17,7 @@ func fileRead(src string) string {
func fileAddLine(input string, filepath string) { func fileAddLine(input string, filepath string) {
_, err := os.Stat(filepath) _, err := os.Stat(filepath)
if errors.Is(err, os.ErrNotExist) { if errors.Is(err, os.ErrNotExist) {
_, err = os.Create(filepath) fileCreate(filepath)
errorPanic(err)
} }
var file *os.File var file *os.File
@ -28,3 +27,11 @@ func fileAddLine(input string, filepath string) {
_, err = file.WriteString(input + "\n") _, err = file.WriteString(input + "\n")
errorPanic(err) errorPanic(err)
} }
func fileCreate(filepath string) {
_, err := os.Create(filepath)
errorPanic(err)
logger("file created -> " + filepath)
}