forked from OCram85/PSCredentialStore
PowerShell 6 Core Support (#35)
## About This pull request reflects all changes done in the `linuxsupport` branch. ## Content - Enable PowerShell 6 Core support - Use PFX Certificate for encryption ( fixes #32 ) - Updates CI / CD pipeline ( fixes #31 ) - uses portable libressl ( fixes #34 ) - adds `-PassThru` switch for returning current `VIServer` session in `Connect-To` ( fixes #34 ) - adds git lfs for embedded libressl files - restructured internal functions into `Private` dir - added certificate related functions - adds travis build pipeline for tests
This commit is contained in:
61
src/Private/Get-DefaultCredentialStorePath.ps1
Normal file
61
src/Private/Get-DefaultCredentialStorePath.ps1
Normal file
@ -0,0 +1,61 @@
|
||||
function Get-DefaultCredentialStorePath {
|
||||
<#
|
||||
.SYNOPSIS
|
||||
Returns the default CredentialStore path based on the current OS.
|
||||
|
||||
.DESCRIPTION
|
||||
This is a low level helper function.
|
||||
|
||||
.INPUTS
|
||||
[None]
|
||||
|
||||
.OUTPUTS
|
||||
[string]
|
||||
|
||||
.EXAMPLE
|
||||
$Path = Get-DefaultCredentialStorePath
|
||||
|
||||
.NOTES
|
||||
File Name : Get-DefaultCredentialStorePath.ps1
|
||||
Author : Marco Blessing - marco.blessing@googlemail.com
|
||||
Requires :
|
||||
|
||||
.LINK
|
||||
https://github.com/OCram85/PSCredentialStore
|
||||
#>
|
||||
[CmdletBinding()]
|
||||
[OutputType([string])]
|
||||
param(
|
||||
[Parameter(Mandatory = $false)]
|
||||
[switch]$Shared
|
||||
)
|
||||
|
||||
begin {}
|
||||
|
||||
process {
|
||||
if ($Shared.IsPresent) {
|
||||
if ($IsLinux) {
|
||||
return Join-Path -Path '/var/opt' -ChildPath 'PSCredentialStore/CredentialStore.json'
|
||||
}
|
||||
if ($IsMacOS) {
|
||||
return Join-Path -Path '/var/opt' -ChildPath 'PSCredentialStore/CredentialStore.json'
|
||||
}
|
||||
elseif (($isWindows) -or ($PSVersionTable.PSVersion.Major -lt 6) -or ($PSVersionTable.PSEdition -eq 'Desktop')) {
|
||||
return Join-Path -Path $env:ProgramData -ChildPath 'PSCredentialStore/CredentialStore.json'
|
||||
}
|
||||
}
|
||||
else {
|
||||
if ($IsLinux) {
|
||||
return Join-Path -Path $Env:HOME -ChildPath 'CredentialStore.json'
|
||||
}
|
||||
if ($IsMacOS) {
|
||||
return Join-Path -Path $Env:HOME -ChildPath 'CredentialStore.json'
|
||||
}
|
||||
elseif (($isWindows) -or ($PSVersionTable.PSVersion.Major -lt 6) -or ($PSVersionTable.PSEdition -eq 'Desktop')) {
|
||||
return Join-Path -Path $env:AppData -ChildPath 'CredentialStore.json'
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
end {}
|
||||
}
|
Reference in New Issue
Block a user