Skip to content

Commit 0e076f7

Browse files
committed
Removed platform dependent compilation statement in favor of runtime logic.
1 parent c03e76a commit 0e076f7

File tree

1 file changed

+16
-6
lines changed

1 file changed

+16
-6
lines changed

Scripts/CustomEditor/Git.cs

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,20 +6,30 @@
66
using System.Diagnostics;
77
using System.IO;
88
using System.Threading.Tasks;
9+
using UnityEditor;
10+
using UnityEngine;
911

1012
namespace CandyCoded.GitStatus
1113
{
1214

15+
[InitializeOnLoad]
1316
public static class Git
1417
{
1518

16-
#if UNITY_EDITOR_WIN
17-
private static string GitPath => @"C:\Program Files\Git\bin\git.exe";
18-
#else
19-
private static string GitPath => "/usr/local/bin/git";
20-
#endif
19+
static Git()
20+
{
21+
22+
GitPath = SystemInfo.operatingSystemFamily.Equals(OperatingSystemFamily.Windows)
23+
? @"C:\Program Files\Git\bin\git.exe"
24+
: "/usr/local/bin/git";
25+
26+
RepoPath = $"{Environment.CurrentDirectory}{Path.DirectorySeparatorChar}";
27+
28+
}
29+
30+
private static string GitPath { get; }
2131

22-
private static string RepoPath => $"{Environment.CurrentDirectory}{Path.DirectorySeparatorChar}";
32+
private static string RepoPath { get; }
2333

2434
public static Process GenerateProcess(string path, string arguments)
2535
{

0 commit comments

Comments
 (0)