Fixing JsonConfigFileAccessor constructor so that it doesn't throw exceptions when run as a regular user.
This commit is contained in:
parent
5e310a7510
commit
ca307e7c95
1 changed files with 4 additions and 14 deletions
|
@ -147,25 +147,15 @@ namespace System.Management.Automation
|
||||||
internal JsonConfigFileAccessor()
|
internal JsonConfigFileAccessor()
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
// Initialize (and create if necessary) the system-wide configuration directory
|
// Sets the system-wide configuration directory
|
||||||
//
|
//
|
||||||
Assembly assembly = typeof(PSObject).GetTypeInfo().Assembly;
|
Assembly assembly = typeof(PSObject).GetTypeInfo().Assembly;
|
||||||
psHomeConfigDirectory = Path.Combine(Path.GetDirectoryName(assembly.Location), configDirectoryName);
|
psHomeConfigDirectory = Path.GetDirectoryName(assembly.Location);
|
||||||
|
|
||||||
if (!Directory.Exists(psHomeConfigDirectory))
|
|
||||||
{
|
|
||||||
Directory.CreateDirectory(psHomeConfigDirectory);
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Initialize (and create if necessary) the per-user configuration directory
|
// Sets the per-user configuration directory
|
||||||
//
|
//
|
||||||
appDataConfigDirectory = Path.Combine(Utils.GetUserSettingsDirectory(), configDirectoryName);
|
appDataConfigDirectory = Utils.GetUserSettingsDirectory();
|
||||||
|
|
||||||
if (!Directory.Exists(appDataConfigDirectory))
|
|
||||||
{
|
|
||||||
Directory.CreateDirectory(appDataConfigDirectory);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
Loading…
Reference in a new issue