dont create AppConfigDirectory if its an empty string (default value)
This commit is contained in:
parent
3d29afac5f
commit
f43da00ff2
@ -32,7 +32,7 @@ Public Class ConfigManager(Of T)
|
||||
GetType(GlobalSettingAttribute)
|
||||
}
|
||||
|
||||
Private _ForceUserConfig As Boolean = False
|
||||
Private _WriteAllValuesToUserConfig As Boolean = False
|
||||
|
||||
''' <summary>
|
||||
''' Returns the currently loaded config object
|
||||
@ -85,8 +85,12 @@ Public Class ConfigManager(Of T)
|
||||
|
||||
_UserDirectory = _File.CreateDirectory(UserConfigPath)
|
||||
_ComputerDirectory = _File.CreateDirectory(ComputerConfigPath)
|
||||
_AppConfigDirectory = _File.CreateDirectory(ApplicationStartupPath)
|
||||
_ForceUserConfig = ForceUserConfig
|
||||
|
||||
If ApplicationStartupPath <> String.Empty Then
|
||||
_AppConfigDirectory = _File.CreateDirectory(ApplicationStartupPath)
|
||||
End If
|
||||
|
||||
_WriteAllValuesToUserConfig = ForceUserConfig
|
||||
|
||||
_UserConfigPath = Path.Combine(_UserDirectory, USER_CONFIG_NAME)
|
||||
_ComputerConfigPath = Path.Combine(_ComputerDirectory, COMPUTER_CONFIG_NAME)
|
||||
@ -187,9 +191,10 @@ Public Class ConfigManager(Of T)
|
||||
_Logger.Error(ex)
|
||||
_Logger.Warn("ApplicationConfig could not be loaded!")
|
||||
End Try
|
||||
_WriteAllValuesToUserConfig = False
|
||||
Else
|
||||
_Logger.Debug("ApplicationConfig does not exist.")
|
||||
_ForceUserConfig = True
|
||||
_WriteAllValuesToUserConfig = True
|
||||
End If
|
||||
|
||||
Return Config
|
||||
@ -204,9 +209,10 @@ Public Class ConfigManager(Of T)
|
||||
_Logger.Error(ex)
|
||||
_Logger.Warn("Computer config could not be loaded!")
|
||||
End Try
|
||||
_WriteAllValuesToUserConfig = False
|
||||
Else
|
||||
_Logger.Debug("Computer config does not exist.")
|
||||
_ForceUserConfig = True
|
||||
_WriteAllValuesToUserConfig = True
|
||||
End If
|
||||
|
||||
Return Config
|
||||
@ -222,7 +228,7 @@ Public Class ConfigManager(Of T)
|
||||
Dim oExcludedAttributes As New List(Of Type)
|
||||
|
||||
' Copy values from user config to final config
|
||||
If _ForceUserConfig Then
|
||||
If _WriteAllValuesToUserConfig Then
|
||||
CopyValues(oUserConfig, Config, New List(Of Type))
|
||||
Else
|
||||
CopyValues(oUserConfig, Config, _ExcludedAttributes)
|
||||
@ -279,7 +285,7 @@ Public Class ConfigManager(Of T)
|
||||
|
||||
' If config was loaded from computer config,
|
||||
' DO NOT save connection string, etc. to user config
|
||||
If _ForceUserConfig = False And ForceAll = False Then
|
||||
If _WriteAllValuesToUserConfig = False And ForceAll = False Then
|
||||
Data = FilterValues(Data, _ExcludedAttributes)
|
||||
End If
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user