fehlerbehebung

This commit is contained in:
xoy 2023-01-28 21:53:09 +01:00
parent 481092554b
commit 1ed0597e04
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)
}