mirror of
https://github.com/Alexandre1a/GoSH.git
synced 2026-03-09 19:19:46 +01:00
Added the ability to create the config folder
This commit is contained in:
parent
b5fb8a86e9
commit
53c5cba02a
6
main.go
6
main.go
@ -79,8 +79,14 @@ func main() {
|
|||||||
// Charger la configuration depuis un fichier
|
// Charger la configuration depuis un fichier
|
||||||
func loadConfig() {
|
func loadConfig() {
|
||||||
homeDir, _ := os.UserHomeDir()
|
homeDir, _ := os.UserHomeDir()
|
||||||
|
|
||||||
configPath := homeDir + "/.config/gosh/"
|
configPath := homeDir + "/.config/gosh/"
|
||||||
fmt.Println("Chemin du fichier de configuration:", configPath)
|
fmt.Println("Chemin du fichier de configuration:", configPath)
|
||||||
|
|
||||||
|
if err := os.MkdirAll(configPath, 0755); err != nil {
|
||||||
|
fmt.Fprintln(os.Stderr, "Erreur lors de la création du dossier de configuration:", err)
|
||||||
|
}
|
||||||
|
|
||||||
viper.AddConfigPath(configPath)
|
viper.AddConfigPath(configPath)
|
||||||
viper.SetConfigName("gosh_config")
|
viper.SetConfigName("gosh_config")
|
||||||
viper.SetConfigType("toml")
|
viper.SetConfigType("toml")
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user