Jump to content

SongRec/Internal formats/preferences.toml

From Fossplant

The preferences.toml file of SongRec is saved, under Linux, at the ~/.config/songrec/preferences.toml path by default, when using an unsandboxed environment.

It uses the TOML format.

It is written through by the src/core/preferences.rs utility file, which open the path of the preferences file through src/utils/filesystem_operations.rs.

Save location

(WIP 2026-05-05)

The location for the preferences.toml file is calculated through the obtain_preferences_file_path function of src/utils/filesystem_operations.rs.

pub fn obtain_preferences_file_path() -> Result<String, Box<dyn Error>> {
    let project_dir =
        ProjectDirs::from(QUALIFIER, ORGANIZATION, APPLICATION).ok_or("No valid path")?;
    let mut preferences_file_path: PathBuf = obtain_preferences_directory(project_dir)?;
    preferences_file_path.push("preferences.toml");
    Ok(preferences_file_path.to_str().unwrap().to_string())
}

Variables

(WIP 2026-05-05)