diff --git a/CHANGELOG.md b/CHANGELOG.md index ecc2759..29822c8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,8 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. ## [Unreleased] ### Added - Added SimplSharpProMono to eRuntimeEnvironment enum + - Added path support for SimplSharpProMono environment + - Added GetApplicationRootDirectory for all platforms ### Changed - Small fixes for better VC4 support diff --git a/ICD.Common.Utils/IO/IcdDirectory.cs b/ICD.Common.Utils/IO/IcdDirectory.cs index 3ac77ad..025d56a 100644 --- a/ICD.Common.Utils/IO/IcdDirectory.cs +++ b/ICD.Common.Utils/IO/IcdDirectory.cs @@ -1,4 +1,5 @@ using System; +using ICD.Common.Utils.Extensions; #if SIMPLSHARP using Crestron.SimplSharp.CrestronIO; #else @@ -19,6 +20,19 @@ namespace ICD.Common.Utils.IO #endif } + /// + /// This gets the application root directory for Crestron systems + /// + /// + public static string GetApplicationRootDirectory() + { +#if SIMPLSHARP + return Directory.GetApplicationRootDirectory(); +#else + return Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().GetPath()); +#endif + } + public static bool Exists(string path) { if (path == null) diff --git a/ICD.Common.Utils/PathUtils.cs b/ICD.Common.Utils/PathUtils.cs index 491fbae..64e21a6 100644 --- a/ICD.Common.Utils/PathUtils.cs +++ b/ICD.Common.Utils/PathUtils.cs @@ -17,7 +17,15 @@ namespace ICD.Common.Utils /// Gets the path to the root directory of the processor. /// [PublicAPI] - public static string RootPath { get { return IcdDirectory.GetDirectoryRoot("\\"); } } + public static string RootPath { + get + { + if (IcdEnvironment.RuntimeEnvironment == IcdEnvironment.eRuntimeEnvironment.SimplSharpProMono) + return IcdDirectory.GetApplicationRootDirectory(); + + return IcdDirectory.GetDirectoryRoot(IcdPath.DirectorySeparatorChar.ToString()); + } + } /// /// Gets the path to the program directory @@ -35,7 +43,7 @@ namespace ICD.Common.Utils get { #if SIMPLSHARP - return Join(RootPath, "USER"); + return Join(RootPath, "User"); #elif LINUX return Join(RootPath, "opt", "ICD.Connect"); #else @@ -53,6 +61,9 @@ namespace ICD.Common.Utils { get { + if (IcdEnvironment.RuntimeEnvironment == IcdEnvironment.eRuntimeEnvironment.SimplSharpProMono) + return Join(RootConfigPath, "ProgramConfig"); + string directoryName = string.Format("Program{0:D2}Config", ProgramUtils.ProgramNumber); return Join(RootConfigPath, directoryName); }