This commit is contained in:
raf 2023-09-07 21:06:26 +03:00
commit c8e82d5d43
No known key found for this signature in database
GPG key ID: 02D1DD3FA08B6B29
13 changed files with 921 additions and 0 deletions

17
internal/util/util.go Normal file
View file

@ -0,0 +1,17 @@
package util
import (
"os"
)
// CreateDirectoryIfNotExists creates the specified directory if it doesn't exist.
func CreateDirectoryIfNotExists(directoryPath string) error {
// Check if the directory already exists
if _, err := os.Stat(directoryPath); os.IsNotExist(err) {
// Directory doesn't exist, create it
if err := os.MkdirAll(directoryPath, 0755); err != nil {
return err
}
}
return nil
}