forked from MattRix/UnityDecompiled
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathManagedProgram.cs
More file actions
64 lines (64 loc) · 1.74 KB
/
Copy pathManagedProgram.cs
File metadata and controls
64 lines (64 loc) · 1.74 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
using System;
using System.Diagnostics;
using System.IO;
using UnityEditor.Scripting.Compilers;
using UnityEditor.Utils;
using UnityEngine;
namespace UnityEditor.Scripting
{
internal class ManagedProgram : Program
{
public ManagedProgram(string monodistribution, string profile, string executable, string arguments) : this(monodistribution, profile, executable, arguments, true)
{
}
public ManagedProgram(string monodistribution, string profile, string executable, string arguments, bool setMonoEnvironmentVariables)
{
string text = ManagedProgram.PathCombine(new string[]
{
monodistribution,
"bin",
"mono"
});
string value = ManagedProgram.PathCombine(new string[]
{
monodistribution,
"lib",
"mono",
profile
});
if (Application.platform == RuntimePlatform.WindowsEditor)
{
text = CommandLineFormatter.PrepareFileName(text + ".exe");
}
ProcessStartInfo processStartInfo = new ProcessStartInfo
{
Arguments = CommandLineFormatter.PrepareFileName(executable) + " " + arguments,
CreateNoWindow = true,
FileName = text,
RedirectStandardError = true,
RedirectStandardOutput = true,
WorkingDirectory = Application.dataPath + "/..",
UseShellExecute = false
};
if (setMonoEnvironmentVariables)
{
processStartInfo.EnvironmentVariables["MONO_PATH"] = value;
processStartInfo.EnvironmentVariables["MONO_CFG_DIR"] = ManagedProgram.PathCombine(new string[]
{
monodistribution,
"etc"
});
}
this._process.StartInfo = processStartInfo;
}
private static string PathCombine(params string[] parts)
{
string text = parts[0];
for (int i = 1; i < parts.Length; i++)
{
text = Path.Combine(text, parts[i]);
}
return text;
}
}
}