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)
|
GetType(GlobalSettingAttribute)
|
||||||
}
|
}
|
||||||
|
|
||||||
Private _ForceUserConfig As Boolean = False
|
Private _WriteAllValuesToUserConfig As Boolean = False
|
||||||
|
|
||||||
''' <summary>
|
''' <summary>
|
||||||
''' Returns the currently loaded config object
|
''' Returns the currently loaded config object
|
||||||
@ -85,8 +85,12 @@ Public Class ConfigManager(Of T)
|
|||||||
|
|
||||||
_UserDirectory = _File.CreateDirectory(UserConfigPath)
|
_UserDirectory = _File.CreateDirectory(UserConfigPath)
|
||||||
_ComputerDirectory = _File.CreateDirectory(ComputerConfigPath)
|
_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)
|
_UserConfigPath = Path.Combine(_UserDirectory, USER_CONFIG_NAME)
|
||||||
_ComputerConfigPath = Path.Combine(_ComputerDirectory, COMPUTER_CONFIG_NAME)
|
_ComputerConfigPath = Path.Combine(_ComputerDirectory, COMPUTER_CONFIG_NAME)
|
||||||
@ -187,9 +191,10 @@ Public Class ConfigManager(Of T)
|
|||||||
_Logger.Error(ex)
|
_Logger.Error(ex)
|
||||||
_Logger.Warn("ApplicationConfig could not be loaded!")
|
_Logger.Warn("ApplicationConfig could not be loaded!")
|
||||||
End Try
|
End Try
|
||||||
|
_WriteAllValuesToUserConfig = False
|
||||||
Else
|
Else
|
||||||
_Logger.Debug("ApplicationConfig does not exist.")
|
_Logger.Debug("ApplicationConfig does not exist.")
|
||||||
_ForceUserConfig = True
|
_WriteAllValuesToUserConfig = True
|
||||||
End If
|
End If
|
||||||
|
|
||||||
Return Config
|
Return Config
|
||||||
@ -204,9 +209,10 @@ Public Class ConfigManager(Of T)
|
|||||||
_Logger.Error(ex)
|
_Logger.Error(ex)
|
||||||
_Logger.Warn("Computer config could not be loaded!")
|
_Logger.Warn("Computer config could not be loaded!")
|
||||||
End Try
|
End Try
|
||||||
|
_WriteAllValuesToUserConfig = False
|
||||||
Else
|
Else
|
||||||
_Logger.Debug("Computer config does not exist.")
|
_Logger.Debug("Computer config does not exist.")
|
||||||
_ForceUserConfig = True
|
_WriteAllValuesToUserConfig = True
|
||||||
End If
|
End If
|
||||||
|
|
||||||
Return Config
|
Return Config
|
||||||
@ -222,7 +228,7 @@ Public Class ConfigManager(Of T)
|
|||||||
Dim oExcludedAttributes As New List(Of Type)
|
Dim oExcludedAttributes As New List(Of Type)
|
||||||
|
|
||||||
' Copy values from user config to final config
|
' Copy values from user config to final config
|
||||||
If _ForceUserConfig Then
|
If _WriteAllValuesToUserConfig Then
|
||||||
CopyValues(oUserConfig, Config, New List(Of Type))
|
CopyValues(oUserConfig, Config, New List(Of Type))
|
||||||
Else
|
Else
|
||||||
CopyValues(oUserConfig, Config, _ExcludedAttributes)
|
CopyValues(oUserConfig, Config, _ExcludedAttributes)
|
||||||
@ -279,7 +285,7 @@ Public Class ConfigManager(Of T)
|
|||||||
|
|
||||||
' If config was loaded from computer config,
|
' If config was loaded from computer config,
|
||||||
' DO NOT save connection string, etc. to user 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)
|
Data = FilterValues(Data, _ExcludedAttributes)
|
||||||
End If
|
End If
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user