diff --git a/Util/LogUtil.cs b/Util/LogUtil.cs index 627c61f..a78f8d5 100644 --- a/Util/LogUtil.cs +++ b/Util/LogUtil.cs @@ -12,7 +12,10 @@ namespace GeekDesk.Util try { Exception ex = exception as Exception; - + if (!Directory.Exists(Constants.ERROR_FILE_PATH.Substring(0, Constants.ERROR_FILE_PATH.LastIndexOf("\\")))) + { + Directory.CreateDirectory(Constants.ERROR_FILE_PATH.Substring(0, Constants.ERROR_FILE_PATH.LastIndexOf("\\"))); + } using (FileStream fs = File.Open(Constants.ERROR_FILE_PATH, FileMode.OpenOrCreate, FileAccess.ReadWrite)) { fs.Seek(0, SeekOrigin.End); @@ -58,6 +61,10 @@ namespace GeekDesk.Util { try { + if (!Directory.Exists(Constants.LOG_FILE_PATH.Substring(0, Constants.LOG_FILE_PATH.LastIndexOf("\\")))) + { + Directory.CreateDirectory(Constants.LOG_FILE_PATH.Substring(0, Constants.LOG_FILE_PATH.LastIndexOf("\\"))); + } using (FileStream fs = File.Open(Constants.LOG_FILE_PATH, FileMode.OpenOrCreate, FileAccess.ReadWrite)) { fs.Seek(0, SeekOrigin.End);