Repository navigation
Conversation
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
path.dirnamefrom@tauri-apps/api/pathreturns an empty string for a path with no directory part, while Node returns.:dirname('file.txt')"""."dirname('README.md')"""."dirname('notes/')"""."Path::parentreturnsSome("")for a bare file name, and the command passed it through. It now returns.in that case. Everything else is unchanged, includingdirname('/'), which still rejects with "path does not have a parent".flowchart TD A[dirname with a bare file name] --> B{Path::parent} B -->|Before| C[empty string returned] B -->|After| D[dot returned like Node.js]Narrated recording of a Tauri app calling the JS API, before (dev) then after (this branch), then the unchanged calls (sound on):
evidence.mp4
The app is
examples/resources(it already grantscore:path:default) with its page temporarily replaced by one that printsawait dirname(...)results; that page is not part of this PR.Unchanged behaviour checked
In the running app (both builds):
dirname('/path/to/somedir/')->"/path/to",dirname('src/main.rs')->"src",dirname('./a')->".",dirname('/a')->"/",dirname('/')-> rejects.Tests
dirnameunit test incrates/tauri/src/path/plugin.rs. With dev's function it fails (left: "", right: "."); with this changecargo test -p tauri --lib path::pluginpasses (4 tests).cargo clippy -p tauri --lib --tests: no warnings in the changed file.rustfmt --checkclean.Change file:
.changes/path-dirname-bare-name.md(tauri: patch:bug).This PR was written with AI assistance (Claude Code), including the test and this description; the change and its results were checked as listed above.