Skip to content
This repository has been archived by the owner on Sep 22, 2023. It is now read-only.

Commit

Permalink
Fix remember settings
Browse files Browse the repository at this point in the history
  • Loading branch information
jazuntee committed Sep 17, 2021
1 parent b75e1a8 commit c50cfc5
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/MSAL.PS.psd1
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ DotNetFrameworkVersion = '4.5'

# Modules to import as nested modules of the module specified in RootModule/ModuleToProcess
NestedModules = @(
'.\internal\Assert-DirectoryExists.ps1'
'.\internal\ConvertFrom-SecureStringAsPlainText.ps1'
'.\internal\ConvertTo-Dictionary.ps1'
'.\internal\Export-Config.ps1'
Expand Down
31 changes: 31 additions & 0 deletions src/internal/Assert-DirectoryExists.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@

function Assert-DirectoryExists {
[CmdletBinding()]
[OutputType([string[]])]
param (
# Directories
[Parameter(Mandatory = $true, ValueFromPipeline = $true, Position = 0)]
[object[]] $InputObjects,
# Directory to base relative paths. Default is current directory.
[Parameter(Mandatory = $false, Position = 2)]
[string] $BaseDirectory = (Get-Location).ProviderPath
)
process {
foreach ($InputObject in $InputObjects) {
## InputObject Casting
if ($InputObject -is [System.IO.DirectoryInfo]) {
[System.IO.DirectoryInfo] $DirectoryInfo = $InputObject
}
elseif ($InputObject -is [System.IO.FileInfo]) {
[System.IO.DirectoryInfo] $DirectoryInfo = $InputObject.Directory
}
elseif ($InputObject -is [string]) {
[System.IO.DirectoryInfo] $DirectoryInfo = $InputObject
}

if (!$DirectoryInfo.Exists) {
Write-Output (New-Item $DirectoryInfo.FullName -ItemType Container)
}
}
}
}

0 comments on commit c50cfc5

Please sign in to comment.