mirror of
https://codeberg.org/scip/kleingebaeck.git
synced 2025-12-16 12:01:00 +01:00
fix #80: using os.MkdirAll():
Recursively create ad dir including output dir. The output dir itself is not being created separately anymore. That way, no directory will be created if no ads could be downloaded.
This commit is contained in:
2
util.go
2
util.go
@@ -32,7 +32,7 @@ import (
|
|||||||
|
|
||||||
func Mkdir(dir string) error {
|
func Mkdir(dir string) error {
|
||||||
if _, err := os.Stat(dir); errors.Is(err, os.ErrNotExist) {
|
if _, err := os.Stat(dir); errors.Is(err, os.ErrNotExist) {
|
||||||
err := os.Mkdir(dir, os.ModePerm)
|
err := os.MkdirAll(dir, os.ModePerm)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("failed to create directory %s: %w", dir, err)
|
return fmt.Errorf("failed to create directory %s: %w", dir, err)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user