mirror of
https://github.com/godotengine/godot.git
synced 2026-02-24 22:36:38 +03:00
Bugfix: Replace // with \\ before sending project path to MSBuild
On Windows with network shares, the project path starts with "//" which MSBuild treats as a command-line switch, causing "Unknown switch" errors. Replace the first two chars with "\\" to make it a proper UNC path.
This commit is contained in:
@@ -154,7 +154,17 @@ namespace GodotTools.Build
|
|||||||
arguments.Add(buildInfo.OnlyClean ? "clean" : "build");
|
arguments.Add(buildInfo.OnlyClean ? "clean" : "build");
|
||||||
|
|
||||||
// C# Project
|
// C# Project
|
||||||
arguments.Add(buildInfo.Project);
|
string projectPath = buildInfo.Project;
|
||||||
|
if (OperatingSystem.IsWindows())
|
||||||
|
{
|
||||||
|
// On Windows, when using a network share path, the path may start with "//"
|
||||||
|
// which MSBuild will treat like a switch. Convert to "\\" to make it an absolute path.
|
||||||
|
if (projectPath.StartsWith("//"))
|
||||||
|
{
|
||||||
|
projectPath = "\\\\" + projectPath.Substring(2);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
arguments.Add(projectPath);
|
||||||
|
|
||||||
// `dotnet clean` doesn't recognize these options
|
// `dotnet clean` doesn't recognize these options
|
||||||
if (!buildInfo.OnlyClean)
|
if (!buildInfo.OnlyClean)
|
||||||
@@ -195,7 +205,17 @@ namespace GodotTools.Build
|
|||||||
arguments.Add("publish"); // `dotnet publish` command
|
arguments.Add("publish"); // `dotnet publish` command
|
||||||
|
|
||||||
// C# Project
|
// C# Project
|
||||||
arguments.Add(buildInfo.Project);
|
string projectPath = buildInfo.Project;
|
||||||
|
if (OperatingSystem.IsWindows())
|
||||||
|
{
|
||||||
|
// On Windows, when using a network share path, the path may start with "//"
|
||||||
|
// which MSBuild will treat like a switch. Convert to "\\" to make it an absolute path.
|
||||||
|
if (projectPath.StartsWith("//"))
|
||||||
|
{
|
||||||
|
projectPath = "\\\\" + projectPath.Substring(2);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
arguments.Add(projectPath);
|
||||||
|
|
||||||
// Restore
|
// Restore
|
||||||
// `dotnet publish` restores by default, unless requested not to
|
// `dotnet publish` restores by default, unless requested not to
|
||||||
|
|||||||
Reference in New Issue
Block a user