tauri-docs
tauri-docs copied to clipboard
wired result of `basename(file, extname(file))`
use ext from call extname
for basename
return wired result:
const ext = await extname('some-json-file.json'); // 'json'
const nameNoExt = await basename('some-json-file.json', ext); // 'some--file.'
Maybe the correct usage is as below?:
const ext = await extname('some-json-file.json'); // 'json'
const nameNoExt = await basename('some-json-file.json', '.' + ext); // some-json-file
Thanks for the report. I think this includes 2 action items.
- Update the docs to be clear about the
.
requirement. - Change the implementation from the currently used replace to maybe something like rsplit_once to make sure we a) don't replace multiple occurences and b) make sure we replace the right most occurence.
/upstream tauri-apps/tauri
/upstream tauri-apps/plugins-workspace
the correct usage would be to add the dot e.g. basename("path/to/file.json", ".json")
however the implementation has a bug as fabian mentioned and we should instead use .strip_suffix()
, I will open PRs to fix this behavior
Upstream issue at https://github.com/tauri-apps/plugins-workspace/issues/1020 has been closed.
PRs for v1 https://github.com/tauri-apps/tauri/pull/9166 and v2 https://github.com/tauri-apps/tauri/pull/9165
Upstream issue at https://github.com/tauri-apps/tauri/issues/9064 has been closed.