Skip to content

Commit 9294912

Browse files
committed
Restricting Shell Compatibility
Regrettably, due to circumstances beyond my control, I am unable to support multiple Shells at this time. As a temporary measure, the following Shell configurations must be used for Linux and Mac: - Linux: Bash - Mac: Zsh This restriction applies specifically to the dotnet build process.
1 parent 32b13e3 commit 9294912

1 file changed

Lines changed: 7 additions & 73 deletions

File tree

Editor/ProjectGeneration/ProjectGeneration.cs

Lines changed: 7 additions & 73 deletions
Original file line numberDiff line numberDiff line change
@@ -1039,79 +1039,13 @@ void GenerateNugetJsonSourceFiles()
10391039

10401040
string GetDotnetCommand()
10411041
{
1042-
string defaultCommand = "dotnet";
1043-
string storedCommand = EditorPrefs.GetString("dotnet-command");
1044-
if (!string.IsNullOrEmpty(storedCommand))
1045-
{
1046-
Debug.Log($"Using stored dotnet command: {storedCommand}");
1047-
return storedCommand;
1048-
}
1049-
1050-
string[] possibleCommands =
1051-
{
1052-
"/bin/zsh",
1053-
"/usr/bin/zsh",
1054-
"/bin/bash",
1055-
"/usr/bin/bash",
1056-
"/bin/ksh",
1057-
"/usr/bin/ksh",
1058-
"/bin/csh",
1059-
"/usr/bin/csh",
1060-
"/bin/dash",
1061-
"/usr/bin/dash",
1062-
"/bin/fish",
1063-
"/usr/bin/fish"
1064-
};
1065-
1066-
bool IsCommandAvailable(string command)
1067-
{
1068-
using var process = new System.Diagnostics.Process();
1069-
var processStartInfo = new System.Diagnostics.ProcessStartInfo
1070-
{
1071-
FileName = command,
1072-
Arguments = "-c \"echo Available\"",
1073-
RedirectStandardOutput = true,
1074-
UseShellExecute = false,
1075-
CreateNoWindow = true
1076-
};
1077-
1078-
process.StartInfo = processStartInfo;
1079-
try
1080-
{
1081-
process.Start();
1082-
string output = process.StandardOutput.ReadToEnd();
1083-
process.WaitForExit();
1084-
1085-
if (output.Contains("Available"))
1086-
{
1087-
Debug.Log($"Found a compatible dotnet command: {command}");
1088-
EditorPrefs.SetString("dotnet-command", command);
1089-
return true;
1090-
}
1091-
}
1092-
catch (Exception)
1093-
{
1094-
// Ignore exceptions and continue to the next command
1095-
}
1096-
finally
1097-
{
1098-
process.Dispose();
1099-
}
1100-
return false;
1101-
}
1102-
1103-
foreach (string command in possibleCommands)
1104-
{
1105-
if (IsCommandAvailable(command))
1106-
{
1107-
return command;
1108-
}
1109-
}
1110-
1111-
Debug.Log(
1112-
$"Could not find a compatible dotnet command. Resolving to default: {defaultCommand}"
1113-
);
1114-
return defaultCommand;
1042+
#if UNITY_EDITOR_WIN
1043+
return "dotnet";
1044+
#elif UNITY_EDITOR_LINUX
1045+
return "/bin/bash";
1046+
#elif UNITY_EDITOR_OSX
1047+
return "/bin/zsh";
1048+
#endif
11151049
}
11161050
}
11171051

0 commit comments

Comments
 (0)