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__.os.tempdir() API regression: broken in windows after latest Tauri update #10285

Closed
abose opened this issue Jul 15, 2024 · 7 comments
Labels
good first issue Good for newcomers status: needs triage This issue needs to triage, applied to new issues type: bug

Comments

@abose
Copy link

abose commented Jul 15, 2024

Describe the bug

In Windows OS, window.__TAURI__.os.tempdir() API is broken. It returns invalid path:. It is easily reproduicable directly in the browser console. Here is the console output:

> await window.__TAURI__.os.tempdir()
> '\\\\?\\C:\\Users\\home\\AppData\\Local\\Temp'
// its supposed to be something like this below:
> await window.__TAURI__.path.appLocalDataDir()
> 'C:\\Users\\home\\AppData\\Local\\io.phcode.dev\\'

Notice the \\\\?\\ prefix which was not coming in earlier.

Background: We were investigating integ test failures on updating to latest tauri builds in this pr: phcode-dev/phoenix-desktop#461

@tauri-apps/cli 1.5.14 -> 1.6.0
tauri 1.6.8 -> 1.7.1
tauri-build 1.5.2 -> 1.5.3

Reproduction

It is easily reproduicable directly in the browser console. Here is the console output:

> await window.__TAURI__.os.tempdir()
> '\\\\?\\C:\\Users\\home\\AppData\\Local\\Temp'

Expected behavior

The path returned should be of the form: C:\\Users\\home\\AppData\\Local\\Temp

Full tauri info output

PS E:\code\phoenix-desktop> tauri info

[✔] Environment                                              
    - OS: Windows 10.0.19045 X64                             
    ✔ WebView2: 126.0.2592.102                               
    ✔ MSVC:                                                  
        - Visual Studio Build Tools 2019                     
        - Visual Studio Build Tools 2022                     
    ✔ rustc: 1.71.0 (8ede3aae2 2023-07-12)                   
    ✔ cargo: 1.71.0 (cfd3bbd8f 2023-06-08)                   
    ✔ rustup: 1.26.0 (5af9b9484 2023-04-05)                  
    ✔ Rust toolchain: stable-x86_64-pc-windows-msvc (default)
    - node: 20.9.0                                           
    - npm: 10.2.0                                            

[-] Packages                                                 
    - tauri [RUST]: 1.7.1                                    
    - tauri-build [RUST]: 1.5.3                              
    - wry [RUST]: 0.24.10                                    
    - tao [RUST]: 0.16.7                                     
    - @tauri-apps/api : not installed!                      
    - @tauri-apps/cli [NPM]: 1.5.14 (outdated, latest: 1.6.0)
                                                             
[-] App                                                      
    - build-type: bundle                                     
    - CSP: unset                                             
    - distDir: ../src/                                       
    - devPath: http://localhost:8000/src/

Stack trace

No response

Additional context

Maybe related to? #10272

@abose abose added status: needs triage This issue needs to triage, applied to new issues type: bug labels Jul 15, 2024
@abose
Copy link
Author

abose commented Jul 15, 2024

NB: The tests are failing in clean builds in github actions as well with latest tauri
see: phcode-dev/phoenix-desktop#461

Exact error log line: https://github.com/phcode-dev/phoenix-desktop/actions/runs/9762153481/job/27052280845?pr=461#step:9:1655

@FabianLars
Copy link
Member

Caused by #9588

@FabianLars
Copy link
Member

Hmm, technically i guess we could also let this count as a bug fix because most other apis should return paths with the //?/ prefix. I'm really only considering this because i don't like the inconsistency.

@amrbashir What's your opinion?
Simply revert this single function? Leave it as is to match the other functions? Add dunce everywhere like in v2 in a patch?

@amrbashir
Copy link
Member

let's use dunce on that API only, to revert and fix the breaking behavior. Any consistency changes that requires breaking changes should be made to v2 only.

@FabianLars
Copy link
Member

coolio, expected that answer but wanted to double check

@datner
Copy link

datner commented Jul 17, 2024

because most other apis should return paths with the //?/ prefix.

@FabianLars why? is \?C:\a\b\c a valid path on windows? why is that prefix desireable?

EDIT: oh my god

@FabianLars
Copy link
Member

Yes it is a valid path. Search for UNC paths to learn more.

That said, it's not really desirable as many tools can't handle them. Tauri's apis return UNC paths because Rust's apis do and since it'd be a breaking change to not return UNC paths (basically this gh issue but the other way around), we can only change it in v2 (and did so)

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

No branches or pull requests

4 participants