mirror of
https://github.com/tauri-apps/tauri.git
synced 2026-04-03 10:11:15 +02:00
* fix(utils): fix resources map becomes directory closes #10187 Fixes the behavior of mapped resources generating extra directory, for example: `"../resources/user.json": "resources/user.json"` generates this resource `resources/user.json/user.json` where it should generate `resources/user.json` This PR includes a refactor of the Iterator implementation which splits it into more scoped functions and relis on recursing instead of a loop which makes the code a lot more readable and easier to maintain. * clippy * cover more cases * clippy * fix glob into directory, not resolving target correctly * return error when resource origin path doesn't exist * fix resources example build * Update .changes/resources-map-becoming-dirs.md --------- Co-authored-by: Lucas Nogueira <lucas@tauri.app>
Resource example
This example demonstrates the Tauri bundle resources functionality. The example adds src-tauri/assets/index.js as a resource (defined on tauri.conf.json > bundle > resources) and executes it using Node.js, locating the JavaScript file using the tauri::App::path_resolver APIs.
Running the example
- Compile Tauri go to root of the Tauri repo and run: Linux / Mac:
# choose to install node cli (1)
bash .scripts/setup.sh
Windows:
./.scripts/setup.ps1
- Install dependencies (Run inside of this folder
examples/resources/)
# with yarn
$ yarn
# with npm
$ npm install
$ yarn tauri
$ yarn package
- Run the app in development mode (Run inside of this folder
examples/resources/)
# with yarn
$ yarn tauri dev
# with npm
$ npm run tauri dev
- Build an run the release app (Run inside of this folder
examples/resources/)
$ yarn tauri build
$ ./src-tauri/target/release/app