Replace the extension on a URI (keeps directories / query strings untouched). Used to fall back from `foo.png` → `foo.dds` when a glTF references a PNG URI that isn't on disk but the DDS sibling is.
(uri: &str, new_ext: &str)
| 1844 | /// untouched). Used to fall back from `foo.png` → `foo.dds` when a |
| 1845 | /// glTF references a PNG URI that isn't on disk but the DDS sibling is. |
| 1846 | fn swap_extension(uri: &str, new_ext: &str) -> String { |
| 1847 | let q = uri.find('?').unwrap_or(uri.len()); |
| 1848 | let (path, query) = uri.split_at(q); |
| 1849 | let new_path = match path.rfind('.') { |
| 1850 | Some(dot) if dot > path.rfind('/').unwrap_or(0) => { |
| 1851 | format!("{}.{}", &path[..dot], new_ext) |
| 1852 | } |
| 1853 | _ => format!("{}.{}", path, new_ext), |
| 1854 | }; |
| 1855 | format!("{}{}", new_path, query) |
| 1856 | } |
| 1857 | |
| 1858 | /// Decode a texture byte slice into RGBA8 pixels + dimensions. Tries |
| 1859 | /// DDS first when the URI extension suggests it (for asset packs like |
no outgoing calls
no test coverage detected