Issue
The tauri-bundler crate states that:
Tauri automatically loads configurations from the tauri.conf.json > bundle object, but this library doesn't rely on it and can be used by non-Tauri apps.
This config in the tauri.config.json can be used to specify additional resources to included in the app bundle. However, there is no documentation detailing how to resolve the resource directory path for a non-Tauri application.
I am aware that in a Tauri application, you can use the app_handle to get the get:
But in the non-Tauri application, the app_handle does not exist.
Context
I am trying to develop a multi-platform application for Windows, Linux, Mac, Android, and iOS but to also have a CLI version for the former three. This CLI app wouldn't use any features from Tauri with the intention to create a smaller app bundle which could be easily launched from docker containers without the need for a bunch of additional libraries that come natively with most OS.
To host the web files, the CLI uses a HTTP server. To keep the code the same, the Tauri app code launches the window (not using the config) and points the window to the same HTTP server; only this time hosted locally. As a result, the static web files need to be included in the installer using the resources attribute.
In the Tauri code, this resource path can be resolved by using:
let resource_dir = app_handle.path().resolve("", BaseDirectory::Resource).ok();
However, in my CLI code, there is no app_handle and the documentation does not state a way to resolve this directory.
My belief was because to resolve the resource directory (and other base directories), the application would need to know the name or identifier of itself. However, the tauri-bundler config state:
name: The name of the built application. If this is not present, then it will use the name value from your Cargo.toml file.
identifier: [REQUIRED] A string that uniquely identifies your application, in reverse-DNS form (for example, "com.example.appname" or "io.github.username.project"). For OS X and iOS, this is used as the bundle's CFBundleIdentifier value; for Windows, this is hashed to create an application GUID.
So the tauri-bundler requires this to bundle the application. Therefore, how do you resolve any of the base directories in a non-Tauri application when bundled with the tauri-bundler?
Issue
The
tauri-bundlercrate states that:This config in the tauri.config.json can be used to specify additional resources to included in the app bundle. However, there is no documentation detailing how to resolve the resource directory path for a non-Tauri application.
I am aware that in a Tauri application, you can use the
app_handleto get the get:But in the non-Tauri application, the
app_handledoes not exist.Context
I am trying to develop a multi-platform application for Windows, Linux, Mac, Android, and iOS but to also have a CLI version for the former three. This CLI app wouldn't use any features from Tauri with the intention to create a smaller app bundle which could be easily launched from docker containers without the need for a bunch of additional libraries that come natively with most OS.
To host the web files, the CLI uses a HTTP server. To keep the code the same, the Tauri app code launches the window (not using the config) and points the window to the same HTTP server; only this time hosted locally. As a result, the static web files need to be included in the installer using the resources attribute.
In the Tauri code, this resource path can be resolved by using:
However, in my CLI code, there is no
app_handleand the documentation does not state a way to resolve this directory.My belief was because to resolve the resource directory (and other base directories), the application would need to know the name or identifier of itself. However, the
tauri-bundlerconfig state:So the
tauri-bundlerrequires this to bundle the application. Therefore, how do you resolve any of the base directories in a non-Tauri application when bundled with thetauri-bundler?