init
This commit is contained in:
parent
79a7534428
commit
c8e82d5d43
13 changed files with 921 additions and 0 deletions
17
internal/util/util.go
Normal file
17
internal/util/util.go
Normal 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
|
||||
}
|
Reference in a new issue