From 4a6fdaa02dbcd73e722d52d08fff7bfb1d9c8b10 Mon Sep 17 00:00:00 2001 From: Joe Date: Thu, 22 Jan 2026 23:05:39 -0600 Subject: [PATCH] Improve path handling in sourcemap processing - Enhanced the logic for creating output file paths by attempting to generate relative paths from the project directory. - Added a fallback to absolute paths for files outside the project directory, improving robustness in path management. --- src/cli/sourcemap.rs | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/cli/sourcemap.rs b/src/cli/sourcemap.rs index 1a4f9500..05cae541 100644 --- a/src/cli/sourcemap.rs +++ b/src/cli/sourcemap.rs @@ -207,9 +207,13 @@ fn recurse_create_node<'a>( } } else { for val in file_paths { - output_file_paths.push(Cow::from( - val.strip_prefix(project_dir).expect(PATH_STRIP_FAILED_ERR), - )); + // Try to create relative path, fall back to absolute if path is outside project dir + match val.strip_prefix(project_dir) { + Ok(relative) => output_file_paths.push(Cow::from(relative)), + Err(_) => output_file_paths.push(Cow::Owned( + path::absolute(val).expect(ABSOLUTE_PATH_FAILED_ERR), + )), + } } };