refactor: better project structure (#35)

This project is starting to grow, and I've seen flaws in the initial
project structure design
I think I'll restructure the entire project directory for better
scalability and also cleaner
This commit is contained in:
VERSE
2026-07-11 16:15:05 +07:00
committed by GitHub
parent 94c8af7b1d
commit 1e04949242
52 changed files with 339 additions and 445 deletions
+42
View File
@@ -0,0 +1,42 @@
package config
import (
"os"
"path/filepath"
)
func ConfigPath() (string, error) {
dir, err := os.UserConfigDir()
if err != nil {
return "", err
}
return filepath.Join(dir, "iris", "config.toml"), nil
}
func StatePath() (string, error) {
dataHome := os.Getenv("XDG_DATA_HOME")
if dataHome == "" {
home, err := os.UserHomeDir()
if err != nil {
return "", err
}
dataHome = filepath.Join(home, ".local", "share")
}
return filepath.Join(dataHome, "iris", "state.toml"), nil
}
func CachePath() (string, error) {
dir, err := os.UserCacheDir()
if err != nil {
return "", err
}
return filepath.Join(dir, "iris"), nil
}
func CrashDir() (string, error) {
cache, err := CachePath()
if err != nil {
return "", err
}
return filepath.Join(cache, "crashes"), nil
}