Skip to content

Commit

Permalink
Fix oversight with relative pathing (also fix directory bug)
Browse files Browse the repository at this point in the history
  • Loading branch information
zCubed3 committed Oct 31, 2023
1 parent 1076dc7 commit bd739bd
Showing 1 changed file with 23 additions and 2 deletions.
25 changes: 23 additions & 2 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -159,18 +159,39 @@ fn main() {
for a in 3..args.len() {
let prefab_dir = PathBuf::from(&args[a]);
let mut relative_export_path = PathBuf::from(&export_path);
relative_export_path.push(prefab_dir.strip_prefix(&src_assets).unwrap());

let sanitized = {
if let Ok(prefab) = prefab_dir.strip_prefix(&src_assets) {
prefab
} else {
prefab_dir.as_path()
}
};

relative_export_path.push(sanitized);
relative_export_path.pop();

let mut import = PathBuf::from(&args[a]);

if !import.starts_with(&src_assets) {
import = PathBuf::from(&src_assets);
import.push(&args[a]);
}

let mut convert = AssetConversion::default();
convert.path = args[a].clone();
convert.path = import.display().to_string();
convert.output_path = relative_export_path.display().to_string();

convert_queue.push(convert);
}

while let Some(convert) = convert_queue.pop() {
let prefab_path = Path::new(&convert.path);

if prefab_path.is_dir() {
continue;
}

let mut prefab_file = File::open(prefab_path).unwrap();

// Copy over the meta file first (if it doesn't exist)
Expand Down

0 comments on commit bd739bd

Please sign in to comment.