From 32a7eada5e918abe3f48b71d88a1454063dd00f2 Mon Sep 17 00:00:00 2001 From: bdbch Date: Fri, 22 May 2026 21:59:33 +0200 Subject: [PATCH] fix(cli): release_dir_abs handles config inside release dir --- .oxrls/.oxrls/882f-useful-mouse.md | 5 +++++ .oxrls/.oxrls/aaca-spare-cradle.md | 5 ----- src/config.rs | 10 +++++++++- 3 files changed, 14 insertions(+), 6 deletions(-) create mode 100644 .oxrls/.oxrls/882f-useful-mouse.md delete mode 100644 .oxrls/.oxrls/aaca-spare-cradle.md diff --git a/.oxrls/.oxrls/882f-useful-mouse.md b/.oxrls/.oxrls/882f-useful-mouse.md new file mode 100644 index 0000000..3b1dba0 --- /dev/null +++ b/.oxrls/.oxrls/882f-useful-mouse.md @@ -0,0 +1,5 @@ +--- +"@bdbchgg/oxrls": "patch" +--- + +Move config to .oxrls/config.json, fix release_dir_abs for nested config \ No newline at end of file diff --git a/.oxrls/.oxrls/aaca-spare-cradle.md b/.oxrls/.oxrls/aaca-spare-cradle.md deleted file mode 100644 index 398f7f0..0000000 --- a/.oxrls/.oxrls/aaca-spare-cradle.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -"@bdbchgg/oxrls": "patch" ---- - -Move config to .oxrls/config.json, add camelCase rename_all \ No newline at end of file diff --git a/src/config.rs b/src/config.rs index 230ef14..690e109 100644 --- a/src/config.rs +++ b/src/config.rs @@ -226,7 +226,15 @@ impl OxrlsConfig { /// Find the config dir (the release_dir relative to config file location or cwd). pub fn release_dir_abs(&self, config_path: &Path) -> PathBuf { let base = config_path.parent().unwrap_or_else(|| Path::new(".")); - base.join(&self.release_dir) + // If the config is already inside the release directory, use the config's parent directly. + // Otherwise, join the release_dir relative to the config's parent. + let release_path = base.join(&self.release_dir); + if release_path == base { + // Config is inside release dir — don't double-join + base.to_path_buf() + } else { + release_path + } } /// Write config to a file. -- 2.51.2