diff --git a/PepperDashEssentials/ControlSystem.cs b/PepperDashEssentials/ControlSystem.cs
index e003cd54..62aee267 100644
--- a/PepperDashEssentials/ControlSystem.cs
+++ b/PepperDashEssentials/ControlSystem.cs
@@ -96,7 +96,7 @@ namespace PepperDash.Essentials
string directoryPrefix;
directoryPrefix = Crestron.SimplSharp.CrestronIO.Directory.GetApplicationRootDirectory();
-
+
var version = Crestron.SimplSharp.Reflection.Assembly.GetExecutingAssembly().GetName().Version;
Global.SetAssemblyVersion(string.Format("{0}.{1}.{2}", version.Major, version.Minor, version.Build));
diff --git a/PepperDashEssentials/UI/EssentialsTouchpanelController.cs b/PepperDashEssentials/UI/EssentialsTouchpanelController.cs
index 11f720a3..df1ecdce 100644
--- a/PepperDashEssentials/UI/EssentialsTouchpanelController.cs
+++ b/PepperDashEssentials/UI/EssentialsTouchpanelController.cs
@@ -106,12 +106,18 @@ namespace PepperDash.Essentials
Debug.Console(0, this, Debug.ErrorLogLevel.Notice, "WARNING: Registration failed. Continuing, but panel may not function: {0}", Panel.RegistrationFailureReason);
// Give up cleanly if SGD is not present.
- var sgdName = Global.FilePathPrefix
- + Global.DirectorySeparator + "sgd" + Global.DirectorySeparator + props.SgdFile;
+ var sgdName = Global.FilePathPrefix + "sgd" + Global.DirectorySeparator + props.SgdFile;
if (!File.Exists(sgdName))
{
- Debug.Console(0, this, "ERROR: Smart object file '{0}' not present. Exiting TSW load", sgdName);
- return;
+ Debug.Console(0, this, "Smart object file '{0}' not present in User folder. Looking for embedded file", sgdName);
+
+ sgdName = Global.ApplicationDirectoryPathPrefix + Global.DirectorySeparator + "SGD" + Global.DirectorySeparator + props.SgdFile;
+
+ if (!File.Exists(sgdName))
+ {
+ Debug.Console(0, this, "Unable to find SGD file '{0}' in User sgd or application SGD folder. Exiting touchpanel load.", sgdName);
+ return;
+ }
}
Panel.LoadSmartObjects(sgdName);
diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Global/Global.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Global/Global.cs
index 999191ea..4ef68066 100644
--- a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Global/Global.cs
+++ b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Global/Global.cs
@@ -26,6 +26,17 @@ namespace PepperDash.Essentials.Core
///
public static string FilePathPrefix { get; private set; }
+ ///
+ /// The file path prefix to the applciation directory
+ ///
+ public static string ApplicationDirectoryPathPrefix
+ {
+ get
+ {
+ return Crestron.SimplSharp.CrestronIO.Directory.GetApplicationDirectory();
+ }
+ }
+
///
/// Returns the directory separator character based on the running OS
///