Skip to content

Commit a6a136e

Browse files
Merge pull request #671 from kaluchi/fix/669-program-data-local-var
fix: ProgramData fallback for restricted environments
2 parents f872e16 + c832109 commit a6a136e

File tree

1 file changed

+3
-8
lines changed

1 file changed

+3
-8
lines changed

PSFramework/internal/scripts/environment.ps1

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -61,14 +61,9 @@ if ($IsLinux -or $IsMacOs)
6161
}
6262
else
6363
{
64-
# Defaults to $Env:ProgramData on Windows
65-
$script:path_FileSystem = Join-Path $Env:ProgramData "$psVersionName\PSFramework\Config"
66-
$script:path_ProgramData = $env:ProgramData
67-
if (-not $script:path_FileSystem)
68-
{
69-
$script:path_ProgramData = [Environment]::GetFolderPath("CommonApplicationData")
70-
$script:path_FileSystem = Join-Path ([Environment]::GetFolderPath("CommonApplicationData")) "$psVersionName\PSFramework\Config"
71-
}
64+
$localProgramData = if ($env:ProgramData) { $env:ProgramData } else { [Environment]::GetFolderPath("CommonApplicationData") }
65+
$script:path_FileSystem = Join-Path $localProgramData "$psVersionName\PSFramework\Config"
66+
$script:path_ProgramData = $localProgramData
7267
}
7368
#endregion System
7469

0 commit comments

Comments
 (0)