Resolve relative asset paths to the app's base asset directory. On Android, relative paths like "assets/models/tree.glb" won't resolve because the working directory isn't the app's data directory.
(path: &str)
| 19 | /// On Android, relative paths like "assets/models/tree.glb" won't resolve |
| 20 | /// because the working directory isn't the app's data directory. |
| 21 | fn resolve_path(path: &str) -> String { |
| 22 | if path.starts_with('/') { |
| 23 | return path.to_string(); |
| 24 | } |
| 25 | unsafe { |
| 26 | if let Some(ref base) = ASSET_BASE_PATH { |
| 27 | format!("{}/{}", base, path) |
| 28 | } else { |
| 29 | path.to_string() |
| 30 | } |
| 31 | } |
| 32 | } |
| 33 | |
| 34 | /// Called by the Android Activity to set the base path for asset resolution. |
| 35 | /// Should be set to the app's files directory where assets are extracted. |
no outgoing calls
no test coverage detected