1- using System ;
2- using System . Collections ;
3- using System . Collections . Generic ;
4- using System . Data . Common ;
5- using System . Diagnostics ;
61using System . IO ;
7- using System . Runtime . CompilerServices ;
8- using System . Threading . Tasks ;
92using Newtonsoft . Json . Linq ;
10- using UnityEngine ;
113
124public static class RivetCLI
135{
@@ -38,10 +30,7 @@ public static bool CLIInstalled()
3830 return false ;
3931 }
4032 return true ;
41- case ErrorResult < JObject > _:
42- return false ;
4333 default :
44- UnityEngine . Debug . Log ( "Got different result type" ) ;
4534 return false ;
4635 }
4736 }
@@ -53,33 +42,28 @@ public static Result<JObject> RunCommand(params string[] args)
5342
5443 public static string GetBinDir ( )
5544 {
56- string homePath = Environment . GetFolderPath ( Environment . SpecialFolder . UserProfile ) ;
45+ string homePath = System . Environment . GetFolderPath ( System . Environment . SpecialFolder . UserProfile ) ;
5746 return Path . Combine ( homePath , ".rivet" , REQUIRED_RIVET_CLI_VERSION , "bin" ) ;
5847 }
5948
6049 public static string GetRivetCLIPath ( )
6150 {
62- // // Assuming _RivetEditorSettings is a static class with a method GetSetting
63- // string cliPath = _RivetEditorSettings.GetSetting(RIVET_CLI_PATH_SETTING);
64- // if (!string.IsNullOrEmpty(cliPath))
65- // {
66- // return cliPath;
67- // }
68-
6951 return Path . Combine ( GetBinDir ( ) , "rivet" ) ;
7052 }
7153
7254 public static Result < JObject > RunRivetCLI ( params string [ ] args )
7355 {
74- UnityEngine . Debug . Log ( $ "Running Rivet CLI: { GetRivetCLIPath ( ) } { string . Join ( " " , args ) } ") ;
56+ // TODO: Turn this on if debug is enabled
57+ // UnityEngine.Debug.Log($"Running Rivet CLI: {GetRivetCLIPath()} {string.Join(" ", args)}");
7558
7659 if ( ! File . Exists ( GetRivetCLIPath ( ) ) )
7760 {
78- UnityEngine . Debug . LogError ( "File does not exist: " + GetRivetCLIPath ( ) ) ;
61+ // TODO: Turn this on if debug is enabled
62+ // UnityEngine.Debug.LogError("File does not exist: " + GetRivetCLIPath());
7963 return new ErrorResult < JObject > ( "File does not exist: " + GetRivetCLIPath ( ) ) ;
8064 }
8165
82- var startInfo = new ProcessStartInfo
66+ var startInfo = new System . Diagnostics . ProcessStartInfo
8367 {
8468 FileName = GetRivetCLIPath ( ) ,
8569 Arguments = string . Join ( " " , args ) ,
@@ -90,21 +74,19 @@ public static Result<JObject> RunRivetCLI(params string[] args)
9074
9175 try
9276 {
93- using ( var process = Process . Start ( startInfo ) )
94- {
95- var output = process . StandardOutput . ReadToEnd ( ) ;
96- process . WaitForExit ( ) ;
77+ using var process = System . Diagnostics . Process . Start ( startInfo ) ;
78+ var output = process . StandardOutput . ReadToEnd ( ) ;
79+ process . WaitForExit ( ) ;
9780
98- return new SuccessResult < JObject > ( JObject . Parse ( output ) ) ;
99- }
81+ return new SuccessResult < JObject > ( JObject . Parse ( output ) ) ;
10082 }
101- catch ( Exception ex )
83+ catch ( System . Exception ex )
10284 {
10385 return new ErrorResult < JObject > ( "Failed to start process: " + ex . Message ) ;
10486 }
10587 }
10688
107- public static Result < string > _install ( )
89+ public static Result < string > Install ( )
10890 {
10991 string bin_dir = GetBinDir ( ) ;
11092
0 commit comments