From 35abe9f5cafd79adaf09c166311074c12690688d Mon Sep 17 00:00:00 2001 From: Tyler Camp Date: Mon, 10 Nov 2014 13:44:48 -0600 Subject: [PATCH] Bugfix - SensorHost crash when the Sensors deploy directory hasn't been created --- .../Construct.SensorHosts.WindowsSensorHost/Service.cs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Construct.SensorHosts/WindowsSensorHost/Construct.SensorHosts.WindowsSensorHost/Service.cs b/Construct.SensorHosts/WindowsSensorHost/Construct.SensorHosts.WindowsSensorHost/Service.cs index 04cd340..c2847dc 100644 --- a/Construct.SensorHosts/WindowsSensorHost/Construct.SensorHosts.WindowsSensorHost/Service.cs +++ b/Construct.SensorHosts/WindowsSensorHost/Construct.SensorHosts.WindowsSensorHost/Service.cs @@ -284,7 +284,10 @@ private void sensorRuntime_DownloadCompletedEvent(Guid sensorID) private void BuildSensorList() { EventLog.WriteEntry("Building sensor list"); - Directory.SetCurrentDirectory(@"C:\Program Files (x86)\Construct\SensorHost\Sensors"); + String sensorsInstallLocation = @"C:\Program Files (x86)\Construct\SensorHost\Sensors"; + if (!Directory.Exists(sensorsInstallLocation)) + Directory.CreateDirectory(sensorsInstallLocation); + Directory.SetCurrentDirectory(sensorsInstallLocation); string[] sensorDirs = Directory.GetDirectories(Directory.GetCurrentDirectory());