Skip to content

Commit

Permalink
allow configuring cache directory
Browse files Browse the repository at this point in the history
  • Loading branch information
edwardmiller-mesirow committed May 22, 2024
1 parent 37cd733 commit 34c30eb
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions Public/ConvertTo-ExcelXlsx.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@ function ConvertTo-ExcelXlsx {
[parameter(Mandatory = $false)]
[switch]$Force,
[parameter(Mandatory = $false)]
[switch]$CacheToTemp
[switch]$CacheToTemp,
[parameter(Mandatory = $false)]
[string]$CacheDirectory
)
process {
try {
Expand Down Expand Up @@ -53,7 +55,11 @@ function ConvertTo-ExcelXlsx {
}

if ($CacheToTemp) {
$tempPath = [System.IO.Path]::Combine([System.IO.Path]::GetTempPath(), [System.IO.Path]::GetFileName($xlsFile.FullName))
if (-not $CacheDirectory) {
$CacheDirectory = [System.IO.Path]::GetTempPath()
}
$tempPath = [System.IO.Path]::Combine($CacheDirectory, [System.IO.Path]::GetFileName($xlsFile.FullName))
Write-Host ("Using Temp path: {0}" -f $tempPath)
Copy-Item -Path $xlsFile.FullName -Destination $tempPath -Force
$fileToProcess = $tempPath
}
Expand Down

0 comments on commit 34c30eb

Please sign in to comment.