Added the ability to create the config folder

This commit is contained in:
Alexandre1a 2025-03-30 22:02:39 +02:00
parent b5fb8a86e9
commit 53c5cba02a
No known key found for this signature in database
GPG Key ID: CE01C28FBC5EEF10
2 changed files with 6 additions and 0 deletions

BIN
.DS_Store vendored Normal file

Binary file not shown.

View File

@ -79,8 +79,14 @@ func main() {
// Charger la configuration depuis un fichier
func loadConfig() {
homeDir, _ := os.UserHomeDir()
configPath := homeDir + "/.config/gosh/"
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.SetConfigName("gosh_config")
viper.SetConfigType("toml")