diff options
author | Soispha <soispha@vhack.eu> | 2024-01-20 15:52:39 +0100 |
---|---|---|
committer | Soispha <soispha@vhack.eu> | 2024-01-20 15:57:56 +0100 |
commit | ba3273c9adffee3d8538aecee18b39374bf6e195 (patch) | |
tree | eb292946e997102f0340f85a26f65f7f0f839f67 /sys/nixpkgs/pkgs/yt/src/constants.rs | |
parent | fix(sys/nixpkgs/yt/{yt,ytc}): Ignore sponsor block API access errors (diff) | |
download | nixos-config-ba3273c9adffee3d8538aecee18b39374bf6e195.zip |
feat(sys/nixpkgs/yt/{yt,ytc}): Persist old selection file
Diffstat (limited to 'sys/nixpkgs/pkgs/yt/src/constants.rs')
-rw-r--r-- | sys/nixpkgs/pkgs/yt/src/constants.rs | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/sys/nixpkgs/pkgs/yt/src/constants.rs b/sys/nixpkgs/pkgs/yt/src/constants.rs index 6965ce63..96995f08 100644 --- a/sys/nixpkgs/pkgs/yt/src/constants.rs +++ b/sys/nixpkgs/pkgs/yt/src/constants.rs @@ -25,7 +25,6 @@ pub const CONCURRENT: u32 = 5; pub const DOWNLOAD_DIR: &str = "/tmp/ytcc"; const STATUS_PATH: &str = "ytcc/running"; - pub fn status_path() -> anyhow::Result<PathBuf> { let out: PathBuf = format!( "{}/{}", @@ -36,3 +35,15 @@ pub fn status_path() -> anyhow::Result<PathBuf> { fs::create_dir_all(&out.parent().expect("Parent should exist"))?; Ok(out) } + +const LAST_SELECT: &str = "ytcc/selected"; +pub fn last_select() -> anyhow::Result<PathBuf> { + let out: PathBuf = format!( + "{}/{}", + env::var("XDG_RUNTIME_DIR").expect("This should always exist"), + LAST_SELECT + ) + .into(); + fs::create_dir_all(&out.parent().expect("Parent should exist"))?; + Ok(out) +} |