2019-01-16 12:55:29 +01:00
|
|
|
function Get-TempDir {
|
|
|
|
<#
|
|
|
|
.SYNOPSIS
|
|
|
|
Returns the valid temp dir of the current OS
|
|
|
|
|
|
|
|
.DESCRIPTION
|
|
|
|
Returns the valid temp dir of the current OS.
|
|
|
|
|
|
|
|
.INPUTS
|
|
|
|
[None]
|
|
|
|
.OUTPUTS
|
|
|
|
[string]
|
|
|
|
|
|
|
|
.EXAMPLE
|
|
|
|
Get-TempDir
|
|
|
|
#>
|
2022-06-28 08:56:33 +02:00
|
|
|
|
2019-01-16 12:55:29 +01:00
|
|
|
[CmdletBinding()]
|
|
|
|
[OutputType([string])]
|
2022-06-28 08:56:33 +02:00
|
|
|
param ()
|
|
|
|
|
|
|
|
begin {}
|
2019-01-16 12:55:29 +01:00
|
|
|
|
|
|
|
process {
|
|
|
|
if ($IsLinux) {
|
|
|
|
return (Resolve-Path -Path '/tmp/').Path
|
|
|
|
}
|
|
|
|
if ($IsMacOS) {
|
|
|
|
return (Resolve-Path -Path '/tmp/').Path
|
|
|
|
}
|
2022-06-28 08:56:33 +02:00
|
|
|
elseif (
|
|
|
|
($isWindows) -or
|
|
|
|
($PSVersionTable.PSVersion.Major -lt 6) -or
|
|
|
|
($PSVersionTable.PSEdition -eq 'Desktop')
|
|
|
|
) {
|
2019-01-16 12:55:29 +01:00
|
|
|
return (Resolve-Path -Path $env:TEMP).Path
|
|
|
|
}
|
|
|
|
}
|
2022-06-28 08:56:33 +02:00
|
|
|
|
|
|
|
end {}
|
2019-01-16 12:55:29 +01:00
|
|
|
}
|