@@ -252,20 +252,19 @@ fn is_cargo_output_directory(path: &std::path::Path) -> bool {
252
252
253
253
/// Computes the resource directory of the current environment.
254
254
///
255
- /// On Windows, it's the path to the executable.
255
+ /// ## Platform-specific
256
256
///
257
- /// On Linux, when running in an AppImage the `APPDIR` variable will be set to
258
- /// the mounted location of the app, and the resource dir will be
259
- /// `${APPDIR}/usr/lib/${exe_name}`. If not running in an AppImage, the path is
260
- /// `/usr/lib/${exe_name}`. When running the app from
261
- /// `src-tauri/target/(debug|release)/`, the path is
262
- /// `${exe_dir}/../lib/${exe_name}`.
263
- ///
264
- /// On MacOS, it's `${exe_dir}../Resources` (inside .app).
265
- ///
266
- /// On iOS, it's `${exe_dir}/assets`.
267
- ///
268
- /// Android uses a special URI prefix that is resolved by the Tauri file system plugin `asset://localhost/`
257
+ /// - **Windows:** Resolves to the directory that contains the main executable.
258
+ /// - **Linux:** When running in an AppImage, the `APPDIR` variable will be set to
259
+ /// the mounted location of the app, and the resource dir will be `${APPDIR}/usr/lib/${exe_name}`.
260
+ /// If not running in an AppImage, the path is `/usr/lib/${exe_name}`.
261
+ /// When running the app from `src-tauri/target/(debug|release)/`, the path is `${exe_dir}/../lib/${exe_name}`.
262
+ /// - **macOS:** Resolves to `${exe_dir}/../Resources` (inside .app).
263
+ /// - **iOS:** Resolves to `${exe_dir}/assets`.
264
+ /// - **Android:** Currently the resources are stored in the APK as assets so it's not a normal file system path,
265
+ /// we return a special URI prefix `asset://localhost/` here that can be used with the [file system plugin](https://tauri.app/plugin/file-system/),
266
+ /// with that, you can read the files through [`FsExt::fs`](https://docs.rs/tauri-plugin-fs/latest/tauri_plugin_fs/trait.FsExt.html#tymethod.fs)
267
+ /// like this: `app.fs().read_to_string(app.path().resource_dir().unwrap().join("resource"));`
269
268
pub fn resource_dir ( package_info : & PackageInfo , env : & Env ) -> crate :: Result < PathBuf > {
270
269
#[ cfg( target_os = "android" ) ]
271
270
return resource_dir_android ( package_info, env) ;
0 commit comments