Temp_dir returning short form path on windows

When using the temp_dir function on windows am am being returned paths seemingly in "short form", for example:
use std::env;

fn main() {


[src\main.rs:4] env::temp_dir() = "C:\Users\MYUSER~1.COR\AppData\Local\Temp\"

Where the actual full path of this directory is "C:\Users\myusername.CORP\AppData\Local\Temp"

Is there a way to either make temp_dir() return the full path, or convert to the full path afterwards? (I ask as libgit2 seems to not like the short form path)

There is std::fs::canonicalize() that expands paths to their canonical form, but this one in turn gives UNC paths in form \\?\C:\, which some applications don't like either. So I wrote dunce for this.


This doesn't answer you question but it might also be worth opening an issue with libgit2. This sounds like something they may want to resolve.