selene-core 0.4.2

selene-core is the backend for Selene, a local-first music player
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
use std::{
    fs, io,
    path::{Path, PathBuf},
};

use crate::library::track::Track;

impl Track {
    pub(crate) fn set_source_file(&mut self, path: PathBuf) {
        self.src_container.set_path(path);
    }

    pub(crate) fn ensure_parent_dirs(&self, library_dir: impl AsRef<Path>) -> io::Result<()> {
        let mut library_dir = library_dir.as_ref().join(&self.relative_library_path);
        library_dir.pop();
        fs::create_dir_all(library_dir)
    }
}