Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions .changes/no-dest-resource-target.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
---
"tauri-utils": "patch:bug"
---

Fix a regression in tauri-utils 2.8.3 that made empty path an invalid resource target, e.g.

```json
{
"bundle": {
"resources": {
"README.md": "",
}
}
}
```

(this means `README.md` -> `$RESOURCE/README.md`, note this is a confusing behavior, and will be changed in v3)
16 changes: 15 additions & 1 deletion crates/tauri-utils/src/resources.rs
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,21 @@ impl ResourcePathsIter<'_> {
// preserving the file name as it is
ResourcePathsInnerIter::Glob { .. } => dest.join(path.file_name().unwrap()),
},
None => dest.clone(),
None => {
if dest.components().count() == 0 {
// if current_dest is empty while processing a file pattern
// we preserve the file name as it is
//
// e.g. `{ "README.md": "" }` is `README.md` -> `$RESOURCE/README.md`
//
// TODO: This behavior is a confusing special case,
// remove this in v3 or make other cases like this work
// > `{ "README.md": "./folder/" }` is `README.md` -> `$RESOURCE/folder/README.md` (this gives `$RESOURCE/folder` today)
Comment on lines +219 to +221

@amrbashir amrbashir May 16, 2026 •

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you explain how is this confusing? for me at least I think of:

  1. README.md -> ./ or just . as $Resource/README.md
  2. README.md -> ./folder as $Resource/folder/README.md since it is a file
  3. directory -> ./ or just . as $Resource/directory

The one I actually think of as confusing is this:
4. directory -> ./folder as $Resource/folder, it should be $Resource/folder/directory

Overall I think we should be following the behavior of cp command on unix

@Legend-Master Legend-Master May 16, 2026 •

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. README.md -> ./folder as $Resource/folder/README.md since it is a file

We can not tell if the target ./folder is a folder (we can if it's written as ./folder/ though), so it gives $RESOURCE/folder today, and that's the confusing part

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. README.md -> ./folder as $Resource/folder/README.md since it is a file
  2. directory -> ./ or just . as $Resource/directory

I don't think these were the case? At least not when I wrote https://tauri.app/develop/resources/#tab-panel-715 🤔 (I wrote it based on the actual behavior we had I believe)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I really don't know how it behaves atm, but if we plan to break this in a new major, I would just suggest being close as possible to cp command, it makes it more obvious and familiar and less confusing

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That makes sense, { "README.md": "./folder/" } must be written as ./folder/ not ./folder to put it at $RESOURCE/folder/README.md though

PathBuf::from(path.file_name().unwrap())
} else {
dest.clone()
}
}
}
} else {
// If [`ResourcePathsIter::pattern_iter`] is a [`PatternIter::Slice`]
Expand Down
Loading