fix mounts; backward compatibility

This commit is contained in:
Mukhtar Akere
2025-02-13 05:07:14 +01:00
parent 6f4f72d781
commit bfd2596367
21 changed files with 71 additions and 466 deletions

View File

@@ -197,21 +197,16 @@ func validateConfig(config *Config) error {
return nil
}
func SetConfigPath(path string) {
// Backward compatibility
// Check if the path is not a dir
if fi, err := os.Stat(path); err == nil && !fi.IsDir() {
// Get the directory of the file
path = filepath.Dir(path)
}
func SetConfigPath(path string) error {
configPath = path
return nil
}
func GetConfig() *Config {
once.Do(func() {
instance = &Config{} // Initialize instance first
if err := instance.loadConfig(); err != nil {
_, err := fmt.Fprintf(os.Stderr, "Configuration Error: %v\n", err)
_, err := fmt.Fprintf(os.Stderr, "configuration Error: %v\n", err)
if err != nil {
return
}