From ba3273c9adffee3d8538aecee18b39374bf6e195 Mon Sep 17 00:00:00 2001 From: Soispha Date: Sat, 20 Jan 2024 15:52:39 +0100 Subject: feat(sys/nixpkgs/yt/{yt,ytc}): Persist old selection file --- sys/nixpkgs/pkgs/yt/src/constants.rs | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) (limited to 'sys/nixpkgs/pkgs/yt/src/constants.rs') 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 { let out: PathBuf = format!( "{}/{}", @@ -36,3 +35,15 @@ pub fn status_path() -> anyhow::Result { fs::create_dir_all(&out.parent().expect("Parent should exist"))?; Ok(out) } + +const LAST_SELECT: &str = "ytcc/selected"; +pub fn last_select() -> anyhow::Result { + 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) +} -- cgit 1.4.1