mirror of
https://github.com/rojo-rbx/rojo.git
synced 2026-10-23 14:01:37 +00:00
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.
This commit is contained in:
parent
9abc0e4728
commit
4a6fdaa02d
1 changed files with 7 additions and 3 deletions
|
|
@ -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),
|
||||
)),
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue