From 22399f23de8191bb3ada03339b94131827797fd7 Mon Sep 17 00:00:00 2001 From: Jonathan Jenne Date: Thu, 13 Feb 2020 13:30:50 +0100 Subject: [PATCH] catch appdirectory not existing --- Modules.Config/ConfigManager.vb | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/Modules.Config/ConfigManager.vb b/Modules.Config/ConfigManager.vb index 5d63f095..8cb829ae 100644 --- a/Modules.Config/ConfigManager.vb +++ b/Modules.Config/ConfigManager.vb @@ -84,18 +84,18 @@ Public Class ConfigManager(Of T) _Serializer = New XmlSerializer(_BlueprintType) _UserDirectory = _File.CreateDirectory(UserConfigPath) + _UserConfigPath = Path.Combine(_UserDirectory, USER_CONFIG_NAME) + _ComputerDirectory = _File.CreateDirectory(ComputerConfigPath) + _ComputerConfigPath = Path.Combine(_ComputerDirectory, COMPUTER_CONFIG_NAME) If ApplicationStartupPath <> String.Empty Then _AppConfigDirectory = _File.CreateDirectory(ApplicationStartupPath) + _AppConfigPath = Path.Combine(_AppConfigDirectory, APP_CONFIG_NAME) End If _WriteAllValuesToUserConfig = ForceUserConfig - _UserConfigPath = Path.Combine(_UserDirectory, USER_CONFIG_NAME) - _ComputerConfigPath = Path.Combine(_ComputerDirectory, COMPUTER_CONFIG_NAME) - _AppConfigPath = Path.Combine(_AppConfigDirectory, APP_CONFIG_NAME) - Config = LoadConfig() End Sub @@ -183,7 +183,7 @@ Public Class ConfigManager(Of T) End Function Private Function LoadAppConfig(ByVal Config As T) As T - If File.Exists(_AppConfigPath) Then + If Not String.IsNullOrEmpty(_AppConfigPath) AndAlso File.Exists(_AppConfigPath) Then Try Dim oAppConfig = ReadFromFile(_AppConfigPath) CopyValues(oAppConfig, Config)