#[Tauri V2] Third-Party Fetch asset url

9 messages · Page 1 of 1 (latest)

devout lotus
#

I have a third party map engine in my app. I'm setting the asset url to fonts folder that is part of the angular apps assets that get deployed to the dist folder.

I have been testing with tauri build -- --debug on Mac and when I use assetUrl = 'tauri://localhost/assets/fonts'; and give that to the map it works as expected.

On Windows I get fetch errors like this using the same format:

Fetch API cannot load tauri://localhost/assets/fonts/arial-unicode-ms-regular/0-255.pbf. URL scheme "tauri" is not supported.

slate kettle
#

On windows it's unfortunately http(s)://tauri.localhost/... (https in v1, http in v2)

devout lotus
#

is there a tauri call to detect if I'm on windows or mac?

slate kettle
#

reading the user agent may also work idk

devout lotus
#

too bad convertFileSrc doesn't handle all this for you 😦

slate kettle
#

what doesn't it handle?

#

convertFileSrc("assets/fonts", "tauri") may actually work for you, or am i missing something?

devout lotus
#

Yes this works across windows and macos returning the proper url format. Now I just need to detect if we are running in local development server mode. Is there a flag for that?