fix(config): use XDG_DATA_HOME for database with .db extension
- commit
- 445f0334cb0779f139a3308180d42d30407444f2
- author
- bnema · · 2025-12-17 20:45 UTC
- parent
- a531dc8
- signature
- unsigned
2 files · +4 -4
M docs/CONFIG.md +1 -1
| @@ -19,7 +19,7 @@ You can still use JSON or YAML if you prefer - dumber automatically detects the | |||
| 19 | 19 | ||
| 20 | 20 | | Key | Type | Default | Description | | |
| 21 | 21 | |-----|------|---------|-------------| | |
| 22 | - | | `database.path` | string | `~/.local/state/dumber/dumber.sqlite` | Database file path | | |
| 22 | + | | `database.path` | string | `~/.local/share/dumber/dumber.db` | Database file path | | |
| 23 | 23 | ||
| 24 | 24 | ## History | |
| 25 | 25 | ||
| @@ -19,7 +19,7 @@ You can still use JSON or YAML if you prefer - dumber automatically detects the | |||||
| 19 | 19 | ||||
| 20 | | Key | Type | Default | Description | | 20 | | Key | Type | Default | Description | | ||
| 21 | |-----|------|---------|-------------| | 21 | |-----|------|---------|-------------| | ||
| 22 | - | | `database.path` | string | `~/.local/state/dumber/dumber.sqlite` | Database file path | | 22 | + | | `database.path` | string | `~/.local/share/dumber/dumber.db` | Database file path | |
| 23 | 23 | ||||
| 24 | ## History | 24 | ## History | ||
| 25 | 25 | ||||
M internal/infrastructure/config/xdg.go +3 -3
| @@ -14,7 +14,7 @@ const ( | |||
| 14 | 14 | ||
| 15 | 15 | const ( | |
| 16 | 16 | appName = "dumber" | |
| 17 | - | databaseName = "dumber.sqlite" | |
| 17 | + | databaseName = "dumber.db" | |
| 18 | 18 | ) | |
| 19 | 19 | ||
| 20 | 20 | // XDGDirs holds the XDG Base Directory paths for the application. | |
| @@ -134,8 +134,8 @@ func GetConfigFile() (string, error) { | |||
| 134 | 134 | } | |
| 135 | 135 | ||
| 136 | 136 | // GetDatabaseFile returns the path to the database file in the data directory. | |
| 137 | - | // The database contains important user data (history, cookies, preferences) and | |
| 138 | - | // therefore belongs in XDG_DATA_HOME, not XDG_STATE_HOME. | |
| 137 | + | // The database contains user data (history, favorites, preferences) that should | |
| 138 | + | // be backed up, so it belongs in XDG_DATA_HOME per the XDG specification. | |
| 139 | 139 | func GetDatabaseFile() (string, error) { | |
| 140 | 140 | dataDir, err := GetDataDir() | |
| 141 | 141 | if err != nil { | |
| @@ -14,7 +14,7 @@ const ( | |||||
| 14 | 14 | ||||
| 15 | const ( | 15 | const ( | ||
| 16 | appName = "dumber" | 16 | appName = "dumber" | ||
| 17 | - | databaseName = "dumber.sqlite" | 17 | + | databaseName = "dumber.db" |
| 18 | ) | 18 | ) | ||
| 19 | 19 | ||||
| 20 | // XDGDirs holds the XDG Base Directory paths for the application. | 20 | // XDGDirs holds the XDG Base Directory paths for the application. | ||
| @@ -134,8 +134,8 @@ func GetConfigFile() (string, error) { | |||||
| 134 | } | 134 | } | ||
| 135 | 135 | ||||
| 136 | // GetDatabaseFile returns the path to the database file in the data directory. | 136 | // GetDatabaseFile returns the path to the database file in the data directory. | ||
| 137 | - | // The database contains important user data (history, cookies, preferences) and | 137 | + | // The database contains user data (history, favorites, preferences) that should |
| 138 | - | // therefore belongs in XDG_DATA_HOME, not XDG_STATE_HOME. | 138 | + | // be backed up, so it belongs in XDG_DATA_HOME per the XDG specification. |
| 139 | func GetDatabaseFile() (string, error) { | 139 | func GetDatabaseFile() (string, error) { | ||
| 140 | dataDir, err := GetDataDir() | 140 | dataDir, err := GetDataDir() | ||
| 141 | if err != nil { | 141 | if err != nil { | ||