fehlerbehebung

This commit is contained in:
xoy 2023-01-29 16:24:58 +01:00
parent e278c6f851
commit 6df99b809c
1 changed files with 3 additions and 5 deletions

View File

@ -29,15 +29,12 @@ func fileAddLine(input string, filepath string) {
} }
func fileCreate(filepath string) { func fileCreate(filepath string) {
if _, err := os.Stat(filepath); err == nil { _, err := os.Stat(filepath)
if errors.Is(err, os.ErrNotExist) {
_, err := os.Create(filepath) _, err := os.Create(filepath)
errorPanic(err) errorPanic(err)
logger("fileCreate : file created -> " + filepath) logger("fileCreate : file created -> " + filepath)
} else if errors.Is(err, os.ErrNotExist) {
logger("fileCreate : file already exists -> " + filepath)
} else {
logger("fileCreate : unknown -> " + filepath)
} }
} }
@ -46,5 +43,6 @@ func fileMkDir(folderpath string) {
if errors.Is(err, os.ErrNotExist) { if errors.Is(err, os.ErrNotExist) {
err = os.Mkdir(folderpath, 0755) err = os.Mkdir(folderpath, 0755)
errorPanic(err) errorPanic(err)
logger("fileMkDir : folder created -> " + folderpath)
} }
} }