gazebosim / gazebosim/sdformat
sdf::findFile search order is counter-intuitive and likely incorrect
- Dominant language
- C++
- Stars
- 216
- Forks
- 125
- Avg merge
- 1d 14h
- Merged PRs (30d)
- 14
Description
**Original report ([archived issue](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/issues/56)) by andy_somerville (Bitbucket: [andy_somerville](https://bitbucket.org/%7B09fd5d4b-d90e-4416-9a6a-2e5cd638472c%7D/)).**
----------------------------------------
Currently `sdf::findFile` searches system level directories before local, or custom path (`SDF_PATH`) specific ones. This prevents searches to non install locations from working correctly.
Additionally it presupposes that the file being searched is below a parent directory "sdformat" when searching in below `SDF_SHARE_PATH`. `Converter::Converter` also prepends a parent called "sdformat" to queries doubling this path to "sdformat/sdformat/" causing it to fail in those cases.
These both directly affect the ability of the integration tests to function correctly for uninstalled builds on systems where there is an older/different system level build already installed.
It is also likely cause problems outside of this scenario.
For backward compatibility the `sdformat` prepend should be kept, but an addional search should be done without it
The current order is:
* URI
* System unversioned (SDF_SHARE_PATH/sdformat)
* System versioned (SDF_SHARE_PATH/sdformat/x.x)
* Custom
* Absolute or Local
The order should probably be almost opposite with added paths to account for "sdformat" parent expectation seen below:
* URI
* Absolute or Local
* Custom
* raw System versioned (SDF_SHARE_PATH/x.x)
* prepended System versioned (SDF_SHARE_PATH/sdformat/x.x)
* raw System unversioned (SDF_SHARE_PATH)
* prepended System unversioned (SDF_SHARE_PATH/sdformat)
Contributor guide
Assessment
This issue has not been assessed yet.