pub fn resource_dir(package_info: &PackageInfo, env: &Env) -> Result<PathBuf>Expand description
Computes the resource directory of the current environment.
§Platform-specific
- Windows: Resolves to the directory that contains the main executable.
- Linux: When running in an AppImage, the
APPDIRvariable will be set to the mounted location of the app, and the resource dir will be${APPDIR}/usr/lib/${exe_name}. If not running in an AppImage, the path is/usr/lib/${exe_name}. When running the app fromsrc-tauri/target/(debug|release)/, the path is${exe_dir}/../lib/${exe_name}. - macOS: Resolves to
${exe_dir}/../Resources(inside .app). - iOS: Resolves to
${exe_dir}/assets. - Android: Currently the resources are stored in the APK as assets so it’s not a normal file system path,
we return a special URI prefix
asset://localhost/here that can be used with the file system plugin, with that, you can read the files throughFsExt::fslike this:app.fs().read_to_string(app.path().resource_dir().unwrap().join("resource"));