mirror of
https://github.com/0ceanSlim/grain.git
synced 2024-11-22 16:47:13 +00:00
15 lines
287 B
Go
15 lines
287 B
Go
|
package utils
|
||
|
|
||
|
import (
|
||
|
"log"
|
||
|
"os"
|
||
|
)
|
||
|
|
||
|
func EnsureFileExists(filePath, examplePath string) {
|
||
|
if _, err := os.Stat(filePath); os.IsNotExist(err) {
|
||
|
err = copyFile(examplePath, filePath)
|
||
|
if err != nil {
|
||
|
log.Fatalf("Failed to copy %s to %s: %v", examplePath, filePath, err)
|
||
|
}
|
||
|
}
|
||
|
}
|