File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -14,7 +14,24 @@ scripts/lib/core/SafeImport.psm1
1414 PowerShell Version: 3.0+
1515#>
1616
17+ # Import CommonEnums first - Validation requires FileSystemPathType enum
18+ # Must be imported before Validation since Validation uses FileSystemPathType in function signatures
19+ $commonEnumsPath = Join-Path $PSScriptRoot ' CommonEnums.psm1'
20+ if ($commonEnumsPath -and -not [string ]::IsNullOrWhiteSpace($commonEnumsPath ) -and (Test-Path - LiteralPath $commonEnumsPath )) {
21+ try {
22+ Import-Module $commonEnumsPath - DisableNameChecking - Force - Global - ErrorAction Stop
23+ }
24+ catch {
25+ # CommonEnums import failed - Validation may fail to parse
26+ $debugLevel = 0
27+ if ($env: PS_PROFILE_DEBUG -and [int ]::TryParse($env: PS_PROFILE_DEBUG , [ref ]$debugLevel ) -and $debugLevel -ge 1 ) {
28+ Write-Warning " [safe-import.init] Failed to import CommonEnums: $ ( $_.Exception.Message ) . Validation module may fail to load."
29+ }
30+ }
31+ }
32+
1733# Import Validation module for path validation
34+ # Note: Validation uses FileSystemPathType which must be available from CommonEnums
1835$validationModulePath = Join-Path $PSScriptRoot ' Validation.psm1'
1936if ($validationModulePath -and -not [string ]::IsNullOrWhiteSpace($validationModulePath ) -and (Test-Path - LiteralPath $validationModulePath )) {
2037 Import-Module $validationModulePath - DisableNameChecking - ErrorAction SilentlyContinue
You can’t perform that action at this time.
0 commit comments