fix: unify data paths to use qbz instead of qbz-nix
Changes all application data paths from qbz-nix to qbz: - Cache directory: ~/.cache/qbz-nix -> ~/.cache/qbz - Config directory: ~/.config/qbz-nix -> ~/.config/qbz - Data directory: ~/.local/share/qbz-nix -> ~/.local/share/qbz This fixes path inconsistencies between development and production builds and resolves asset protocol permission issues with downloaded album artwork. cp
This commit is contained in:
1 parent
94e26cd593
commit
5f725195c2
9 files changed
+13
-13
No files matched your search
@@ -18,7 +18,7 @@ impl ApiCacheState {
|
|||||||
pub fn new() -> Result<Self, String> {
|
pub fn new() -> Result<Self, String> {
|
||||||
let data_dir = dirs::data_dir()
|
let data_dir = dirs::data_dir()
|
||||||
.ok_or("Could not determine data directory")?
|
.ok_or("Could not determine data directory")?
|
||||||
.join("qbz-nix")
|
.join("qbz")
|
||||||
.join("cache");
|
.join("cache");
|
||||||
|
|
||||||
std::fs::create_dir_all(&data_dir)
|
std::fs::create_dir_all(&data_dir)
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ impl AudioSettingsStore {
|
|||||||
pub fn new() -> Result<Self, String> {
|
pub fn new() -> Result<Self, String> {
|
||||||
let data_dir = dirs::data_dir()
|
let data_dir = dirs::data_dir()
|
||||||
.ok_or("Could not determine data directory")?
|
.ok_or("Could not determine data directory")?
|
||||||
.join("qbz-nix");
|
.join("qbz");
|
||||||
|
|
||||||
std::fs::create_dir_all(&data_dir)
|
std::fs::create_dir_all(&data_dir)
|
||||||
.map_err(|e| format!("Failed to create data directory: {}", e))?;
|
.map_err(|e| format!("Failed to create data directory: {}", e))?;
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ impl Default for DownloadSettings {
|
|||||||
fn default() -> Self {
|
fn default() -> Self {
|
||||||
let default_root = dirs::cache_dir()
|
let default_root = dirs::cache_dir()
|
||||||
.unwrap_or_else(|| std::path::PathBuf::from("."))
|
.unwrap_or_else(|| std::path::PathBuf::from("."))
|
||||||
.join("qbz-nix")
|
.join("qbz")
|
||||||
.join("audio")
|
.join("audio")
|
||||||
.to_string_lossy()
|
.to_string_lossy()
|
||||||
.to_string();
|
.to_string();
|
||||||
@@ -36,7 +36,7 @@ impl DownloadSettingsStore {
|
|||||||
pub fn new() -> Result<Self, String> {
|
pub fn new() -> Result<Self, String> {
|
||||||
let data_dir = dirs::data_dir()
|
let data_dir = dirs::data_dir()
|
||||||
.ok_or("Could not determine data directory")?
|
.ok_or("Could not determine data directory")?
|
||||||
.join("qbz-nix");
|
.join("qbz");
|
||||||
|
|
||||||
std::fs::create_dir_all(&data_dir)
|
std::fs::create_dir_all(&data_dir)
|
||||||
.map_err(|e| format!("Failed to create data directory: {}", e))?;
|
.map_err(|e| format!("Failed to create data directory: {}", e))?;
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ use serde::{Deserialize, Serialize};
|
|||||||
use std::fs;
|
use std::fs;
|
||||||
use std::path::PathBuf;
|
use std::path::PathBuf;
|
||||||
|
|
||||||
const SERVICE_NAME: &str = "qbz-nix";
|
const SERVICE_NAME: &str = "qbz";
|
||||||
const QOBUZ_CREDENTIALS_KEY: &str = "qobuz-credentials";
|
const QOBUZ_CREDENTIALS_KEY: &str = "qobuz-credentials";
|
||||||
const FALLBACK_FILE_NAME: &str = ".qbz-auth";
|
const FALLBACK_FILE_NAME: &str = ".qbz-auth";
|
||||||
|
|
||||||
@@ -27,7 +27,7 @@ pub struct QobuzCredentials {
|
|||||||
|
|
||||||
/// Get the fallback credentials file path
|
/// Get the fallback credentials file path
|
||||||
fn get_fallback_path() -> Option<PathBuf> {
|
fn get_fallback_path() -> Option<PathBuf> {
|
||||||
dirs::config_dir().map(|p| p.join("qbz-nix").join(FALLBACK_FILE_NAME))
|
dirs::config_dir().map(|p| p.join("qbz").join(FALLBACK_FILE_NAME))
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Simple XOR obfuscation (not secure, but avoids plain text)
|
/// Simple XOR obfuscation (not secure, but avoids plain text)
|
||||||
|
|||||||
@@ -129,7 +129,7 @@ impl DownloadCacheState {
|
|||||||
pub fn new() -> Result<Self, String> {
|
pub fn new() -> Result<Self, String> {
|
||||||
let cache_dir = dirs::cache_dir()
|
let cache_dir = dirs::cache_dir()
|
||||||
.ok_or("Could not determine cache directory")?
|
.ok_or("Could not determine cache directory")?
|
||||||
.join("qbz-nix")
|
.join("qbz")
|
||||||
.join("audio");
|
.join("audio");
|
||||||
|
|
||||||
// Create directories
|
// Create directories
|
||||||
|
|||||||
@@ -431,7 +431,7 @@ impl LibraryDatabase {
|
|||||||
ELSE MIN(artist)
|
ELSE MIN(artist)
|
||||||
END as artist,
|
END as artist,
|
||||||
MIN(year) as year,
|
MIN(year) as year,
|
||||||
MAX(artwork_path) as artwork,
|
MAX(CASE WHEN artwork_path IS NOT NULL THEN artwork_path END) as artwork,
|
||||||
COUNT(*) as track_count,
|
COUNT(*) as track_count,
|
||||||
SUM(duration_secs) as total_duration,
|
SUM(duration_secs) as total_duration,
|
||||||
MAX(format) as format,
|
MAX(format) as format,
|
||||||
@@ -468,7 +468,7 @@ impl LibraryDatabase {
|
|||||||
ELSE MIN(artist)
|
ELSE MIN(artist)
|
||||||
END as artist,
|
END as artist,
|
||||||
MIN(year) as year,
|
MIN(year) as year,
|
||||||
MAX(artwork_path) as artwork,
|
MAX(CASE WHEN artwork_path IS NOT NULL THEN artwork_path END) as artwork,
|
||||||
COUNT(*) as track_count,
|
COUNT(*) as track_count,
|
||||||
SUM(duration_secs) as total_duration,
|
SUM(duration_secs) as total_duration,
|
||||||
MAX(format) as format,
|
MAX(format) as format,
|
||||||
@@ -511,7 +511,7 @@ impl LibraryDatabase {
|
|||||||
let artist: String = row.get(2)?;
|
let artist: String = row.get(2)?;
|
||||||
let artwork_path: Option<String> = row.get(4)?;
|
let artwork_path: Option<String> = row.get(4)?;
|
||||||
|
|
||||||
log::debug!("Album grouping {}: artwork_path = {:?}", group_key, artwork_path);
|
log::info!("Album {} by {}: artwork_path = {:?}", album, artist, artwork_path);
|
||||||
|
|
||||||
Ok(LocalAlbum {
|
Ok(LocalAlbum {
|
||||||
id: group_key.clone(),
|
id: group_key.clone(),
|
||||||
|
|||||||
@@ -58,7 +58,7 @@ impl LyricsState {
|
|||||||
pub fn new() -> Result<Self, String> {
|
pub fn new() -> Result<Self, String> {
|
||||||
let cache_dir = dirs::cache_dir()
|
let cache_dir = dirs::cache_dir()
|
||||||
.ok_or("Could not determine cache directory")?
|
.ok_or("Could not determine cache directory")?
|
||||||
.join("qbz-nix")
|
.join("qbz")
|
||||||
.join("lyrics");
|
.join("lyrics");
|
||||||
|
|
||||||
std::fs::create_dir_all(&cache_dir)
|
std::fs::create_dir_all(&cache_dir)
|
||||||
|
|||||||
@@ -84,7 +84,7 @@ impl RecoState {
|
|||||||
pub fn new() -> Result<Self, String> {
|
pub fn new() -> Result<Self, String> {
|
||||||
let data_dir = dirs::data_dir()
|
let data_dir = dirs::data_dir()
|
||||||
.ok_or("Could not determine data directory")?
|
.ok_or("Could not determine data directory")?
|
||||||
.join("qbz-nix")
|
.join("qbz")
|
||||||
.join("reco");
|
.join("reco");
|
||||||
|
|
||||||
std::fs::create_dir_all(&data_dir)
|
std::fs::create_dir_all(&data_dir)
|
||||||
|
|||||||
@@ -54,7 +54,7 @@ impl SessionStore {
|
|||||||
pub fn new() -> Result<Self, String> {
|
pub fn new() -> Result<Self, String> {
|
||||||
let data_dir = dirs::data_dir()
|
let data_dir = dirs::data_dir()
|
||||||
.ok_or("Could not determine data directory")?
|
.ok_or("Could not determine data directory")?
|
||||||
.join("qbz-nix");
|
.join("qbz");
|
||||||
|
|
||||||
std::fs::create_dir_all(&data_dir)
|
std::fs::create_dir_all(&data_dir)
|
||||||
.map_err(|e| format!("Failed to create data directory: {}", e))?;
|
.map_err(|e| format!("Failed to create data directory: {}", e))?;
|
||||||
|
|||||||
Reference in new issue
Block a user