🐛 Make sure data directory exists on first run
This commit is contained in:
@ -38,6 +38,9 @@ func createDefaultConfig(name string) {
|
|||||||
dest_path := fmt.Sprintf("%s/%s.toml", CONFIG_DIR, name)
|
dest_path := fmt.Sprintf("%s/%s.toml", CONFIG_DIR, name)
|
||||||
source_path := fmt.Sprintf("sample_configs/%s.toml", name)
|
source_path := fmt.Sprintf("sample_configs/%s.toml", name)
|
||||||
|
|
||||||
|
if _, err := os.Stat(CONFIG_DIR); errors.Is(err, os.ErrNotExist) {
|
||||||
|
os.MkdirAll(CONFIG_DIR, 0744)
|
||||||
|
}
|
||||||
if _, err := os.Stat(dest_path); errors.Is(err, os.ErrNotExist) {
|
if _, err := os.Stat(dest_path); errors.Is(err, os.ErrNotExist) {
|
||||||
content, err := sampleConfig.ReadFile(source_path)
|
content, err := sampleConfig.ReadFile(source_path)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
Reference in New Issue
Block a user