fehlerbehebung
This commit is contained in:
parent
8031477f38
commit
024214120f
12
file.go
12
file.go
|
@ -29,23 +29,27 @@ func fileAddLine(input string, filepath string) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func fileCreate(filepath string) {
|
func fileCreate(filepath string) {
|
||||||
if !fileExist(filepath) {
|
if _, err := os.Stat(filepath); err == nil {
|
||||||
_, err := os.Create(filepath)
|
_, err := os.Create(filepath)
|
||||||
errorPanic(err)
|
errorPanic(err)
|
||||||
|
|
||||||
logger("fileCreate : file created -> " + filepath)
|
logger("fileCreate : file created -> " + filepath)
|
||||||
} else {
|
} else if errors.Is(err, os.ErrNotExist) {
|
||||||
logger("fileCreate : file already exists -> " + filepath)
|
logger("fileCreate : file already exists -> " + filepath)
|
||||||
|
} else {
|
||||||
|
logger("fileCreate : unknown -> " + filepath)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func fileCreateDir(dirpath string) {
|
func fileCreateDir(dirpath string) {
|
||||||
if fileExist(dirpath) {
|
if _, err := os.Stat(dirpath); err == nil {
|
||||||
err := os.Mkdir(dirpath, 0755)
|
err := os.Mkdir(dirpath, 0755)
|
||||||
errorPanic(err)
|
errorPanic(err)
|
||||||
logger("fileCreateDir : folder created -> " + dirpath)
|
logger("fileCreateDir : folder created -> " + dirpath)
|
||||||
} else {
|
} else if errors.Is(err, os.ErrNotExist) {
|
||||||
logger("fileCreateDir : folder not created -> " + dirpath)
|
logger("fileCreateDir : folder not created -> " + dirpath)
|
||||||
|
} else {
|
||||||
|
logger("fileCreateDir : unknown -> " + dirpath)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue