Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[bug] Tauri Path API shows wrong path \\?\ #5850

Closed
williamscaramuzzi opened this issue Dec 16, 2022 · 6 comments
Closed

[bug] Tauri Path API shows wrong path \\?\ #5850

williamscaramuzzi opened this issue Dec 16, 2022 · 6 comments
Labels
status: needs triage This issue needs to triage, applied to new issues type: bug

Comments

@williamscaramuzzi
Copy link

williamscaramuzzi commented Dec 16, 2022

Describe the bug

I'm trying to do some file manipulation in a simple Desktop App, and I'm stuck. When using File System, everything is OK and I can create a simple text file in my Desktop folder.
But when I try to retrieve the current folder where the .exe is running, the path is shown with this weird characters at the begining: \?
image

Reproduction

  1. Download my repository where I put this simple app https://github.com/williamscaramuzzi/tauri-file-attempt
  2. I'm using Windows 11 and I installed all the current updates (I did this yesterday)
  3. Just execute npm run tauri dev and follow the text on screen.

Expected behavior

I expected the path to be written as "C:\Users\willi\Desktop\ and so on"

Platform and versions

image

Stack trace

No response

Additional context

No response

@williamscaramuzzi williamscaramuzzi added status: needs triage This issue needs to triage, applied to new issues type: bug labels Dec 16, 2022
@FabianLars
Copy link
Member

These are not reallyyy wrong paths. They are indeed valid, and are called UNC paths, the main reason to use them is to allow much larger paths (32k chars instead of 255). Unfortunately it turns out that (too) many libraries don't support them so imo we should look into removing the UNC part :/

@FabianLars FabianLars closed this as not planned Won't fix, can't repro, duplicate, stale Dec 19, 2022
@JohnScience
Copy link

@FabianLars There's a popular dunce library on crates.io, which does precisely that.

@FabianLars
Copy link
Member

yep, i (we) are aware of that. We just can't change the paths in a 1.X release because it would technically be a breaking change.

@NaughtyDog6000
Copy link

are there plans to change this for 2.0 or is this remaining as is?

@FabianLars
Copy link
Member

@NaughtyDog6000
The change already landed in v2 a while ago but only paths returned from JS apis will be changed. The rust apis will return the paths as-is (like the underlying rust methods do).

@WSH032
Copy link
Contributor

WSH032 commented Jan 28, 2025

This is definitely unfortunate! When I naively passed PathResolver::resource_dir() to Python, I got bitten by Python.

I think the biggest problem is that the path format returned by PathResolver is inconsistent:

  • resource_dir() returns a UNC path \\?\E:\xxx
  • video_dir() returns a simple path E:\xxx

I haven't checked other directories yet, but I suspect that paths returned by tauri_utils are UNC paths, while those returned by dirs are simple paths.

I believe PathResolver should either return a consistent path format or document which APIs return UNC paths.

Otherwise, for users who do not look at the implementation code of PathResolver, they can only wait to get bitten before coming to this issue. 😥

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: needs triage This issue needs to triage, applied to new issues type: bug
Projects
None yet
Development

No branches or pull requests

5 participants