feat: Path support for VC-4

This commit is contained in:
Drew Tingen
2019-01-22 09:11:48 -08:00
parent aae4fb6185
commit a9d411dcfd
2 changed files with 38 additions and 3 deletions

View File

@@ -19,6 +19,18 @@ namespace ICD.Common.Utils.IO
#endif
}
#if SIMPLSHARP
/// <summary>
/// This gets the application root directory for Crestron systems
/// </summary>
/// <returns></returns>
public static string GetApplicationRootDirectory()
{
return Directory.GetApplicationRootDirectory();
}
#endif
public static bool Exists(string path)
{
if (path == null)

View File

@@ -3,6 +3,9 @@ using System.Linq;
using ICD.Common.Properties;
using ICD.Common.Utils.Extensions;
using ICD.Common.Utils.IO;
#if SIMPLSHARP
using Crestron.SimplSharp;
#endif
namespace ICD.Common.Utils
{
@@ -17,7 +20,16 @@ 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 SIMPLSHARP
if (IcdEnvironment.RuntimeEnvironment == IcdEnvironment.eRuntimeEnvironment.SimplSharpProMono)
return IcdDirectory.GetApplicationRootDirectory();
#endif
return IcdDirectory.GetDirectoryRoot(IcdPath.DirectorySeparatorChar.ToString());
}
}
/// <summary>
/// Gets the path to the program directory
@@ -35,7 +47,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 +65,12 @@ namespace ICD.Common.Utils
{
get
{
#if SIMPLSHARP
if (CrestronEnvironment.DevicePlatform == eDevicePlatform.Server)
{
return Join(RootConfigPath, "ProgramConfig");
}
#endif
string directoryName = string.Format("Program{0:D2}Config", ProgramUtils.ProgramNumber);
return Join(RootConfigPath, directoryName);
}
@@ -62,7 +80,12 @@ namespace ICD.Common.Utils
/// Returns the absolute path to the common configuration directory.
/// </summary>
[PublicAPI]
public static string CommonConfigPath { get { return Join(RootConfigPath, "CommonConfig"); } }
public static string CommonConfigPath {
get
{
return Join(RootConfigPath, "CommonConfig");
}
}
/// <summary>
/// Returns the absolute path to the common config library directory.