|
6 | 6 | using System.IO; |
7 | 7 | using System.Linq; |
8 | 8 | using System.Text; |
| 9 | +using System.Windows.Forms; |
9 | 10 | /// <summary> |
10 | 11 | /// test 2 |
11 | 12 | /// </summary> |
@@ -36,23 +37,42 @@ static void Help() |
36 | 37 | } |
37 | 38 | static void Initialize() |
38 | 39 | { |
39 | | - Config.Global.IntermediatePath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "..", "..", Config.Global.IntermediatePath); |
| 40 | + |
40 | 41 | Config.Global.LoadConfig(); |
| 42 | + if(String.IsNullOrEmpty( Config.Global.BasePath)||!Directory.Exists(Config.Global.BasePath)) |
| 43 | + { |
| 44 | + using (var fbd = new FolderBrowserDialog()) |
| 45 | + { |
| 46 | + DialogResult result = fbd.ShowDialog(); |
| 47 | + |
| 48 | + if (result == DialogResult.OK && !string.IsNullOrWhiteSpace(fbd.SelectedPath)) |
| 49 | + { |
| 50 | + Config.Global.BasePath = fbd.SelectedPath; |
| 51 | + Config.Global.SaveConfig(); |
| 52 | + } |
| 53 | + else |
| 54 | + { |
| 55 | + Application.Exit(); |
| 56 | + } |
| 57 | + } |
| 58 | + } |
| 59 | + |
| 60 | + Config.Global.IntermediatePath = Path.Combine(Config.Global.BasePath, Config.Global.IntermediatePath); |
41 | 61 | if (!Directory.Exists(Config.Global.IntermediatePath)) |
42 | 62 | { |
43 | 63 | Directory.CreateDirectory(Config.Global.IntermediatePath); |
44 | 64 | } |
45 | 65 | Config.Global.IntermediatePath = Path.GetFullPath(Config.Global.IntermediatePath); |
46 | 66 |
|
47 | | - Config.Global.BinariesPath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "..", "..", Config.Global.BinariesPath); |
| 67 | + Config.Global.BinariesPath = Path.Combine(Config.Global.BasePath, Config.Global.BinariesPath); |
48 | 68 |
|
49 | 69 | if (!Directory.Exists(Config.Global.BinariesPath)) |
50 | 70 | { |
51 | 71 | Directory.CreateDirectory(Config.Global.BinariesPath); |
52 | 72 | } |
53 | 73 | Config.Global.BinariesPath = Path.GetFullPath(Config.Global.BinariesPath); |
54 | 74 |
|
55 | | - Config.Global.ProjectsPath = Path.GetFullPath(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "..", "..", Config.Global.ProjectsPath)); |
| 75 | + Config.Global.ProjectsPath = Path.GetFullPath(Path.Combine(Config.Global.BasePath, Config.Global.ProjectsPath)); |
56 | 76 |
|
57 | 77 | Config.Global.ProjectsCSFile = new Dictionary<string, string>(); |
58 | 78 |
|
@@ -246,16 +266,16 @@ static void CallAction(string arg,string[] args,int i) |
246 | 266 | if (arg == "-cleanall") |
247 | 267 | { |
248 | 268 | Console.WriteLine("Полная чистка"); |
249 | | - Config.Global.IntermediatePath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "..", "..", Config.Global.IntermediatePath); |
| 269 | + Config.Global.IntermediatePath = Path.Combine(Config.Global.BasePath, Config.Global.IntermediatePath); |
250 | 270 |
|
251 | 271 | if (Directory.Exists(Config.Global.IntermediatePath)) |
252 | 272 | { |
253 | 273 | Config.Global.IntermediatePath = Path.GetFullPath(Config.Global.IntermediatePath); |
254 | 274 | Directory.Delete(Config.Global.IntermediatePath); |
255 | 275 | } |
256 | | - if (FileSystem.ExistsFile(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "..", "..", "Bear.sln"))) |
| 276 | + if (FileSystem.ExistsFile(Path.Combine(Config.Global.BasePath, "Bear.sln"))) |
257 | 277 | { |
258 | | - File.Delete(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "..", "..", "Bear.sln")); |
| 278 | + File.Delete(Path.Combine(Config.Global.BasePath, "Bear.sln")); |
259 | 279 | } |
260 | 280 | System.Environment.Exit(0); |
261 | 281 | } |
|
0 commit comments