Initial scaffold: project structure, .gitignore, go.mod
This commit is contained in:
26
internal/config/paths_linux.go
Normal file
26
internal/config/paths_linux.go
Normal file
@@ -0,0 +1,26 @@
|
||||
//go:build linux
|
||||
|
||||
package config
|
||||
|
||||
import (
|
||||
"os"
|
||||
"path/filepath"
|
||||
)
|
||||
|
||||
// ConfigDir returns ~/.config/syncwarden.
|
||||
func ConfigDir() string {
|
||||
if xdg := os.Getenv("XDG_CONFIG_HOME"); xdg != "" {
|
||||
return filepath.Join(xdg, "syncwarden")
|
||||
}
|
||||
home, _ := os.UserHomeDir()
|
||||
return filepath.Join(home, ".config", "syncwarden")
|
||||
}
|
||||
|
||||
// SyncthingConfigPath returns the default Syncthing config.xml path on Linux.
|
||||
func SyncthingConfigPath() string {
|
||||
if xdg := os.Getenv("XDG_CONFIG_HOME"); xdg != "" {
|
||||
return filepath.Join(xdg, "syncthing", "config.xml")
|
||||
}
|
||||
home, _ := os.UserHomeDir()
|
||||
return filepath.Join(home, ".config", "syncthing", "config.xml")
|
||||
}
|
||||
Reference in New Issue
Block a user