forked from SharpMap/SharpMap
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMain.cs
More file actions
40 lines (32 loc) · 1.15 KB
/
Main.cs
File metadata and controls
40 lines (32 loc) · 1.15 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
using System;
using System.Configuration;
using System.IO;
using System.Text;
namespace TestGtk
{
class MainClass
{
public static void Main (string[] args)
{
PrepareEnvironment();
Gtk.Application.Init();
using (var win = new MainWindow())
win.Show();
Gtk.Application.Run();
}
private static void PrepareEnvironment()
{
var asr = new AppSettingsReader();
var msysDir = new StringBuilder((string) asr.GetValue("MSYS2InstallDir", typeof(string)));
if (!msysDir.ToString().EndsWith("\\")) msysDir.Append('\\');
if (IntPtr.Size == 4)
msysDir.AppendFormat("mingw32\\bin");
else
msysDir.AppendFormat("mingw64\\bin");
if (!Directory.Exists(msysDir.ToString()))
throw new Exception("MSYS INSTALLATION DIR NOT FOUND");
msysDir.AppendFormat(";{0}", Environment.GetEnvironmentVariable("PATH", EnvironmentVariableTarget.Process));
Environment.SetEnvironmentVariable("PATH", msysDir.ToString(), EnvironmentVariableTarget.Process);
}
}
}