mirror of
https://github.com/danbulant/Cosmos
synced 2026-05-19 20:39:01 +00:00
49 lines
No EOL
1.7 KiB
C#
49 lines
No EOL
1.7 KiB
C#
using System;
|
|
using System.IO;
|
|
using Microsoft.Win32;
|
|
|
|
namespace Cosmos.Build.Common {
|
|
public static class CosmosPaths {
|
|
public static readonly string UserKit;
|
|
public static readonly string Build;
|
|
public static readonly string Vsip;
|
|
public static readonly string Tools;
|
|
public static readonly string Kernel;
|
|
public static readonly string GdbClientExe;
|
|
//
|
|
public static readonly string DevKit = null;
|
|
public static readonly string DebugStubSrc;
|
|
|
|
static string CheckPath(string aPath1, string aPath2) {
|
|
return CheckPath(Path.Combine(aPath1, aPath2));
|
|
}
|
|
static string CheckPath(string aPath) {
|
|
if (Directory.Exists(aPath) || File.Exists(aPath)) {
|
|
return aPath;
|
|
}
|
|
throw new Exception(aPath + " not found.");
|
|
}
|
|
|
|
static CosmosPaths() {
|
|
using (var xReg = Registry.LocalMachine.OpenSubKey(@"Software\Cosmos", false)) {
|
|
if (xReg == null) {
|
|
throw new Exception(@"HKEY_LOCAL_MACHINE\SOFTWARE\Cosmos was not found.");
|
|
}
|
|
UserKit = (string)xReg.GetValue("UserKit");
|
|
}
|
|
Build = CheckPath(UserKit, @"Build");
|
|
Vsip = CheckPath(UserKit, @"Build\VSIP");
|
|
Tools = CheckPath(UserKit, @"Build\Tools");
|
|
Kernel = CheckPath(UserKit, @"Kernel");
|
|
GdbClientExe = CheckPath(UserKit, @"Build\VSIP\Cosmos.Debug.GDB.exe");
|
|
DebugStubSrc = CheckPath(UserKit, @"XSharp\DebugStub");
|
|
|
|
using (var xReg = Registry.CurrentUser.OpenSubKey(@"Software\Cosmos", false)) {
|
|
if (xReg != null) {
|
|
DevKit = (string)xReg.GetValue("DevKit");
|
|
DebugStubSrc = CheckPath(DevKit, @"source2\Compiler\Cosmos.Compiler.DebugStub");
|
|
}
|
|
}
|
|
}
|
|
}
|
|
} |