Skip to content

Commit

Permalink
code improvement
Browse files Browse the repository at this point in the history
  • Loading branch information
Atoo35 committed Feb 7, 2024
1 parent 2bfd32f commit 01ddae5
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions utils/scaffold.go
Original file line number Diff line number Diff line change
Expand Up @@ -94,13 +94,13 @@ func scaffoldDirs(basePath string, dirs map[string]interface{}, setVariables map
case string: // If it's a file, create the file
createFile(basePath, name, v, setVariables)
case map[string]interface{}: // If it's a directory, recursively call scaffoldDirs
newPath := createDirectory(basePath, name, v, setVariables)
newPath := createDirectory(basePath, name)
scaffoldDirs(newPath, v, setVariables)
default:
if strings.Contains(name, ".") {
createFile(basePath, name, "", setVariables)
} else {
createDirectory(basePath, name, nil, setVariables)
createDirectory(basePath, name)
}
}
}
Expand All @@ -113,7 +113,7 @@ func createFile(basePath, name, content string, setVariables map[string]string)
helper.Fatal(fmt.Sprintf("Failed to create file %s: %s", filePath, err), true, err)
}

func createDirectory(basePath, name string, content map[string]interface{}, setVariables map[string]string) string {
func createDirectory(basePath, name string) string {
newPath := filepath.Join(basePath, name)
err := os.Mkdir(newPath, 0755)
helper.Fatal(fmt.Sprintf("Error creating folder %s: %v", newPath, err), true, err)
Expand Down

0 comments on commit 01ddae5

Please sign in to comment.