tauri-apps/cargo-mobile2

`cargo mobile init` on windows passes UNC path to git -C

MoAlyousef opened this issue · 3 comments

Hello

Running cargo mobile init passes a canonicalized UNC path on windows which is rejected by Git.
With mingw bash: (a similar error occurs when using cmd.exe and powershell).

$ cargo mobile init
Project name (wrp): hello
Stylized name (Hello): Hello
Domain (example.com): neurosrg.com
Detected template packs:
  [0] bevy
  [1] bevy-demo
  [2] wgpu
  [3] winit
  [4] wry
  Enter an index for a template pack above.
Template pack (0): 4
Generating base project...
fatal: cannot change to '\?D:devtutorial3wrp': No such file or directory
error: Failed to initialize git
    Command "git -C \\\\?\\D:\\dev\\tutorial3\\wrp init" didn't complete successfully, exiting with
    code 128.

This is most likely caused by this issue:
rust-lang/rust#42869

I think just removing the call to canonicalize here should fix the issue on windows:
https://github.com/tauri-apps/tauri-mobile/blob/0b10eec445391f459af694ae6646f9dda6c60fc1/src/config/mod.rs#L132

can't reproduce with bash or powershell

Hmm maybe a toolchain issue on my side. I built cargo mobile using Rust 1.65 with stable-x86_64-pc-windows-gnu. I'll try using the msvc toolchain and report back.

Rebuilding tauri-mobile with the msvc toolchain seems to resolve the issue!