From ff17dcdb757656c5e81b10070a7bbcc4ef3e97f7 Mon Sep 17 00:00:00 2001 From: nsfisis Date: Sun, 9 Aug 2026 06:39:08 +0900 Subject: refactor(path): build paths with Path::join Concatenating a directory, MAIN_SEPARATOR and a component reimplements what Path::join already does. Joining directly also drops the separator from the intermediate values it used to be baked into, such as ClassLoader's $pathEnd. Co-Authored-By: Claude Opus 5 (1M context) --- crates/shirabe/src/util/filesystem.rs | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) (limited to 'crates/shirabe/src/util/filesystem.rs') diff --git a/crates/shirabe/src/util/filesystem.rs b/crates/shirabe/src/util/filesystem.rs index a12c6d64..2c4cbcc6 100644 --- a/crates/shirabe/src/util/filesystem.rs +++ b/crates/shirabe/src/util/filesystem.rs @@ -488,12 +488,11 @@ impl Filesystem { let mut result = true; for file in &ri { - let target_path = format!( - "{}{}{}", - target, - std::path::MAIN_SEPARATOR, - ri.get_sub_pathname() - ); + let target_path = Path::new(&target) + .join(ri.get_sub_pathname()) + .into_os_string() + .into_string() + .unwrap(); if file.is_dir() { self.ensure_directory_exists(&target_path)?; } else { -- cgit v1.3.1-4-g156e