Merge branch 'feat/VC-4' of Common/Utils into MetLife_v5.4

This commit is contained in:
Chris Cameron
2019-01-22 17:51:47 +00:00
committed by Gogs
3 changed files with 29 additions and 2 deletions

View File

@@ -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

View File

@@ -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
}
/// <summary>
/// This gets the application root directory for Crestron systems
/// </summary>
/// <returns></returns>
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)

View File

@@ -17,7 +17,15 @@ namespace ICD.Common.Utils
/// Gets the path to the root directory of the processor.
/// </summary>
[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());
}
}
/// <summary>
/// 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);
}