Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding LiteralPath to Get-Item alls. #5

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions DSCResources/MSFT_xArchive/MSFT_xArchive.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ Function Assert-ValidStandardArgs
Throw-InvalidArgumentException ($LocalizedData.InvalidSourcePath -f $Path) "Path"
}

$item = Get-Item -EA Ignore $Destination
$item = Get-Item -ErrorAction Ignore -LiteralPath $Destination
if($item -and $item.GetType() -eq [System.IO.FileInfo])
{
Throw-InvalidArgumentException ($LocalizedData.InvalidDestinationDirectory -f $Destination) "Destination"
Expand Down Expand Up @@ -327,7 +327,7 @@ function Test-ExpandArchive
Trace-Message "Going for cache entries"
$result = $true
$cacheObj = Get-CacheEntry $Path $Destination
$sourceLastWriteTime = (Get-Item $Path).LastWriteTime
$sourceLastWriteTime = (Get-Item -LiteralPath $Path).LastWriteTime
$cacheUpToDate = $cacheObj -and $cacheObj.SourceLastWriteTime -and $cacheObj.SourceLastWriteTime -eq $sourceLastWriteTime
$file = $null
try
Expand Down Expand Up @@ -365,7 +365,7 @@ function Test-ExpandArchive
}
else
{
$item = Get-Item $dest -EA Ignore
$item = Get-Item -LiteralPath $dest -ErrorAction Ignore
if(-not $item)
{
$individualResult = $result = $false
Expand Down Expand Up @@ -455,7 +455,7 @@ function Test-ExpandArchive
Function Ensure-Directory
{
param([string] $Dir)
$item = get-item $Dir -EA SilentlyContinue
$item = Get-Item -LiteralPath $Dir -ErrorAction SilentlyContinue
if(-not $item)
{
Trace-Message "Folder $Dir does not exist"
Expand Down Expand Up @@ -537,7 +537,7 @@ function Set-ExpandArchive
}

$cacheObj = Get-CacheEntry $Path $Destination
$sourceLastWriteTime = (Get-Item $Path).LastWriteTime
$sourceLastWriteTime = (Get-Item -LiteralPath $Path).LastWriteTime
$cacheUpToDate = $cacheObj -and $cacheObj.SourceLastWriteTime -and $cacheObj.SourceLastWriteTime -eq $sourceLastWriteTime
$file = $null
$nameToEntry = @{}
Expand Down Expand Up @@ -572,7 +572,7 @@ function Set-ExpandArchive
}

$existing = Join-Path $Destination $entry.FullName
$item = Get-Item $existing -EA SilentlyContinue
$item = Get-Item -LiteralPath $existing -ErrorAction SilentlyContinue
if(-not $item)
{
continue
Expand Down Expand Up @@ -630,7 +630,7 @@ function Set-ExpandArchive
{
Trace-Message "Examining $directory to see if it should be removed"
$existing = Join-Path $Destination $directory
$item = Get-Item $existing -EA SilentlyContinue
$item = Get-Item -LiteralPath $existing -ErrorAction SilentlyContinue
if($item -and $item.GetType() -eq [System.IO.DirectoryInfo] -and $item.GetFiles().Count -eq 0 -and $item.GetDirectories().Count -eq 0 `
-and $PSCmdlet.ShouldProcess(($LocalizedData.RemoveDirectory -f $existing), $null, $null))
{
Expand All @@ -654,7 +654,7 @@ function Set-ExpandArchive
continue
}

$item = Get-Item $dest -EA SilentlyContinue
$item = Get-Item -LiteralPath $dest -ErrorAction SilentlyContinue
if($item)
{
if($item.GetType() -eq [System.IO.FileInfo])
Expand Down