4
4
using System ;
5
5
using System . Collections . Generic ;
6
6
using System . Diagnostics ;
7
+ using System . IO ;
7
8
using System . Threading . Tasks ;
8
9
9
10
namespace CandyCoded . GitStatus
@@ -13,18 +14,21 @@ public static class Git
13
14
{
14
15
15
16
#if UNITY_EDITOR_WIN
16
- public static string GitPath => "C:\\ Program Files\\ Git\\ cmd \ \ git.exe" ;
17
+ private static string GitPath => @ "C:\Program Files\Git\bin \git.exe";
17
18
#else
18
- public static string GitPath => "/usr/local/bin/git" ;
19
+ private static string GitPath => "/usr/local/bin/git" ;
19
20
#endif
20
21
21
- private static Process GenerateProcess ( string path , string arguments )
22
+ private static string RepoPath => $ "{ Environment . CurrentDirectory } { Path . DirectorySeparatorChar } ";
23
+
24
+ public static Process GenerateProcess ( string path , string arguments )
22
25
{
23
26
24
27
return Process . Start ( new ProcessStartInfo
25
28
{
26
29
FileName = path ,
27
30
Arguments = arguments ,
31
+ WorkingDirectory = RepoPath ,
28
32
UseShellExecute = false ,
29
33
RedirectStandardOutput = true ,
30
34
RedirectStandardError = true ,
@@ -33,7 +37,7 @@ private static Process GenerateProcess(string path, string arguments)
33
37
34
38
}
35
39
36
- private static Task < Process > GenerateProcessAsync ( string path , string arguments )
40
+ public static Task < Process > GenerateProcessAsync ( string path , string arguments )
37
41
{
38
42
39
43
return Task . Run ( ( ) => GenerateProcess ( path , arguments ) ) ;
0 commit comments