Mostly address #213.
Mostly because there is still an issue when migrating between a relative and an absolute path that is not addressed by this PR but that is a bit of a hairier one.
Fix applied
When using the old file name as a path to migrate from, the path would have an additional ../. The previous logic would substitute the filename in the old path and calculate a diff which wouldn't exactly work, for example
# Asset source is Local://scan.png
# OLD PATH:
folder/map/map.building.yaml
# OLD with asset name
folder/map/scan.png
# NEW
folder/map/new_map.site.ron
# Going from NEW path to OLD with asset name through path_diff:
../scan.png
This is wrong and I believe what we should be doing instead is setting NEW to be the folder containing the file, so this PR changes to the following:
# OLD is unchanged
# NEW Is the parent of the passed file:
folder/map
# Diff between folder/map/scan.png and folder/map
scan.png
Test it!
Just run the site editor opening a legacy map then hit Ctrl-S to save it as a site to a new file:
cargo run --release -- ~/rmf_ws/src/demonstrations/rmf_demos/rmf_demos_maps/maps/hotel/hotel.building.yaml
Without this PR, a bunch of errors will be printed showing failure to load the drawings (and the new hotel.site.ron file will have wrong paths:
Bug fix
Fixed bug
Mostly address #213. Mostly because there is still an issue when migrating between a relative and an absolute path that is not addressed by this PR but that is a bit of a hairier one.
Fix applied
When using the old file name as a path to migrate from, the path would have an additional
../
. The previous logic would substitute the filename in the old path and calculate a diff which wouldn't exactly work, for exampleThis is wrong and I believe what we should be doing instead is setting
NEW
to be the folder containing the file, so this PR changes to the following:Test it!
Just run the site editor opening a legacy map then hit
Ctrl-S
to save it as a site to a new file:Without this PR, a bunch of errors will be printed showing failure to load the drawings (and the new
hotel.site.ron
file will have wrong paths:With this PR the errors will not be present and the file will be correctly exported.