77using System . IO ;
88using System . Net ;
99using System . Reflection ;
10+ using System . Runtime . InteropServices ;
1011using System . Threading ;
11- using MonoGame . Framework . Utilities ;
1212
1313namespace Microsoft . Xna . Framework . Content . Pipeline
1414{
@@ -32,31 +32,31 @@ public static int Run(string command, string arguments)
3232 static void RestoreDotnetTool ( string command , string toolName , string toolVersion , string path )
3333 {
3434 Directory . CreateDirectory ( path ) ;
35- var exe = CurrentPlatform . OS == OS . Windows ? "dotnet.exe" : "dotnet" ;
35+ var exe = RuntimeInformation . IsOSPlatform ( OSPlatform . Windows ) ? "dotnet.exe" : "dotnet" ;
3636 var dotnetRoot = Environment . GetEnvironmentVariable ( "DOTNET_ROOT" ) ;
3737 if ( ! string . IsNullOrEmpty ( dotnetRoot ) )
3838 {
3939 exe = Path . Combine ( dotnetRoot , exe ) ;
4040 }
41- if ( Run ( exe , $ "tool { command } { toolName } --version { toolVersion } --tool-path .", out string stdout , out string stderr , workingDirectory : path ) != 0 )
41+ if ( Run ( exe , $ "tool { command } { toolName } --version { toolVersion } --tool-path .", out string stdout , out string stderr , workingDirectory : path ) != 0 )
4242 {
4343 // install the latest
44- Debug . WriteLine ( $ "{ command } returned { stdout } { stderr } . Trying backup path.") ;
45- Run ( exe , $ "tool { command } { toolName } --tool-path .", out stdout , out stderr , workingDirectory : path ) ;
44+ Debug . WriteLine ( $ "{ command } returned { stdout } { stderr } . Trying backup path.") ;
45+ Run ( exe , $ "tool { command } { toolName } --tool-path .", out stdout , out stderr , workingDirectory : path ) ;
4646 }
4747 }
4848
4949 /// <summary>
5050 /// Run a dotnet tool. The tool should be installed in a .config/dotnet-tools.json file somewhere in the project lineage.
5151 /// </summary>
52- public static int RunDotnetTool ( string toolName , string args , out string stdOut , out string stdErr , string stdIn = null , string workingDirectory = null )
52+ public static int RunDotnetTool ( string toolName , string args , out string stdOut , out string stdErr , string stdIn = null , string workingDirectory = null )
5353 {
5454 var exe = FindCommand ( toolName ) ;
55- var finalizedArgs = args ;
55+ var finalizedArgs = args ;
5656 return ExternalTool . Run ( exe , finalizedArgs , out stdOut , out stdErr , stdIn , workingDirectory ) ;
5757 }
5858
59- public static int Run ( string command , string arguments , out string stdout , out string stderr , string stdin = null , string workingDirectory = null )
59+ public static int Run ( string command , string arguments , out string stdout , out string stderr , string stdin = null , string workingDirectory = null )
6060 {
6161 // This particular case is likely to be the most common and thus
6262 // warrants its own specific error message rather than falling
@@ -164,12 +164,12 @@ private static string FindCommand(string command)
164164
165165 // For Linux check specific subfolder
166166 var lincom = Path . Combine ( AppDomain . CurrentDomain . BaseDirectory , "linux" , command ) ;
167- if ( CurrentPlatform . OS == OS . Linux && File . Exists ( lincom ) )
167+ if ( RuntimeInformation . IsOSPlatform ( OSPlatform . Linux ) && File . Exists ( lincom ) )
168168 return lincom ;
169169
170170 // For Mac check specific subfolder
171171 var maccom = Path . Combine ( AppDomain . CurrentDomain . BaseDirectory , "osx" , command ) ;
172- if ( CurrentPlatform . OS == OS . MacOSX && File . Exists ( maccom ) )
172+ if ( RuntimeInformation . IsOSPlatform ( OSPlatform . OSX ) && File . Exists ( maccom ) )
173173 return maccom ;
174174
175175 // We don't have a full path, so try running through the system path to find it.
@@ -184,7 +184,7 @@ private static string FindCommand(string command)
184184 if ( File . Exists ( fullName ) )
185185 return fullName ;
186186
187- if ( CurrentPlatform . OS == OS . Windows )
187+ if ( RuntimeInformation . IsOSPlatform ( OSPlatform . Windows ) )
188188 {
189189 var fullExeName = string . Concat ( fullName , ".exe" ) ;
190190 if ( File . Exists ( fullExeName ) )
0 commit comments