@@ -37,7 +37,7 @@ func Load(workingDir string, debug bool) (*Config, error) {
37 // uses default config paths
37 // uses default config paths
38 configPaths := []string{
38 configPaths := []string{
39 globalConfig(),
39 globalConfig(),
40− globalConfigData(),
40+ GlobalConfigData(),
41 filepath.Join(workingDir, fmt.Sprintf("%s.json", appName)),
41 filepath.Join(workingDir, fmt.Sprintf("%s.json", appName)),
42 filepath.Join(workingDir, fmt.Sprintf(".%s.json", appName)),
42 filepath.Join(workingDir, fmt.Sprintf(".%s.json", appName)),
@@ -510,9 +510,9 @@ func globalConfig() string {
510 return filepath.Join(os.Getenv("HOME"), ".config", appName, fmt.Sprintf("%s.json", appName))
510 return filepath.Join(os.Getenv("HOME"), ".config", appName, fmt.Sprintf("%s.json", appName))
513−// globalConfigData returns the path to the main data directory for the application.
513+// GlobalConfigData returns the path to the main data directory for the application.
514// this config is used when the app overrides configurations instead of updating the global config.
514// this config is used when the app overrides configurations instead of updating the global config.
515−func globalConfigData() string {
515+func GlobalConfigData() string {
516 xdgDataHome := os.Getenv("XDG_DATA_HOME")
516 xdgDataHome := os.Getenv("XDG_DATA_HOME")
517 if xdgDataHome != "" {
517 if xdgDataHome != "" {
518 return filepath.Join(xdgDataHome, appName, fmt.Sprintf("%s.json", appName))
518 return filepath.Join(xdgDataHome, appName, fmt.Sprintf("%s.json", appName))
@@ -531,3 +531,14 @@ func globalConfigData() string {
532 return filepath.Join(os.Getenv("HOME"), ".local", "share", appName, fmt.Sprintf("%s.json", appName))
532 return filepath.Join(os.Getenv("HOME"), ".local", "share", appName, fmt.Sprintf("%s.json", appName))
535+func HomeDir() string {
536+ homeDir := os.Getenv("HOME")
538+ homeDir = os.Getenv("USERPROFILE") // For Windows compatibility
541+ homeDir = os.Getenv("HOMEPATH") // Fallback for some environments