8000 Update CimDSCParser to fix Configuration compilation for DSC (#6225) · TravisEz13/PowerShell@fb6cd6a · GitHub
[go: up one dir, main page]

Skip to content

Commit fb6cd6a

Browse files
mbreakey3TravisEz13
authored andcommitted
Update CimDSCParser to fix Configuration compilation for DSC (PowerShell#6225)
Update CimDSCParser to fix Configuration compilation for DSC
1 parent 6dce7a6 commit fb6cd6a

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed

src/System.Management.Automation/DscSupport/CimDSCParser.cs

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -663,7 +663,18 @@ public static void Initialize(Collection<Exception> errors, List<string> moduleP
663663
}
664664
else
665665
{
666-
var systemResourceRoot = Path.Combine(Platform.GetFolderPath(Environment.SpecialFolder.System), "Configuration");
666+
// DSC SxS scenario
667+
var configSystemPath = Utils.DefaultPowerShellAppBase;
668+
var systemResourceRoot = Path.Combine(configSystemPath, "Configuration");
669+
var inboxModulePath = "Modules\\PSDesiredStateConfiguration";
670+
671+
if (!Directory.Exists(systemResourceRoot))
672+
{
673+
configSystemPath = Platform.GetFolderPath(Environment.SpecialFolder.System);
674+
systemResourceRoot = Path.Combine(configSystemPath, "Configuration");
675+
inboxModulePath = InboxDscResourceModulePath;
676+
}
677+
667678
var programFilesDirectory = Platform.GetFolderPath(Environment.SpecialFolder.ProgramFiles);
668679
Debug.Assert(programFilesDirectory != null, "Program Files environment variable does not exist!");
669680
var customResourceRoot = Path.Combine(programFilesDirectory, "WindowsPowerShell\\Configuration");
@@ -704,7 +715,7 @@ public static void Initialize(Collection<Exception> errors, List<string> moduleP
704715
List<string> modulePaths = new List<string>();
705716
if (modulePathList == null || modulePathList.Count == 0)
706717
{
707-
modulePaths.Add(Path.Combine(Platform.GetFolderPath(Environment.SpecialFolder.System), InboxDscResourceModulePath));
718+
modulePaths.Add(Path.Combine(configSystemPath, inboxModulePath));
708719
isInboxResource = true;
709720
}
710721
else

0 commit comments

Comments
 (0)
0