Fix PATH variable on Windows

I spent ~7 hours debugging this.
I searched for a bug in the Exec task and found nothing.
I tried different ways to invoke the dotnet command
to make sure PATH is always set before.
I also modified Microsoft.NETCore.Native.Unix.targets to echo PATH via Exec and via Text.
But in the end I was confused about seeing two PATH variables
when checking the dotnet.exe subprocess with ProcessHacker.
This made me try setting the Path variable instead of PATH
and to my surprise this just worked.
Turns out Windows environment variables are case-sensitive and
Windows uses Path instead of PATH like Unix.

God, I love Microsoft Windows. :)
This commit is contained in:
TSR Berry 2023-07-22 01:59:41 +02:00 committed by Emmanuel Hansen
parent 14cf6efa60
commit ee4e18ff0d

View File

@ -84,7 +84,8 @@ tasks.register('compileLibRyujinx', Exec) {
OperatingSystem os = DefaultNativePlatform.currentOperatingSystem OperatingSystem os = DefaultNativePlatform.currentOperatingSystem
if (toolchainPath != null) { if (toolchainPath != null) {
if (os.isWindows()) { if (os.isWindows()) {
environment "PATH", "${toolchainPath};${providers.environmentVariable("PATH").get()}" // NOTE: This is not a typo. dotnet.exe actually uses Path instead of PATH.
environment "Path", "${toolchainPath};${providers.environmentVariable("PATH").get()}"
} }
else { else {
environment "PATH", "${toolchainPath}:${providers.environmentVariable("PATH").get()}" environment "PATH", "${toolchainPath}:${providers.environmentVariable("PATH").get()}"