Skip to content
This repository has been archived by the owner on Feb 16, 2021. It is now read-only.

Commit

Permalink
Unix separator for VirtualEnv Prompt
Browse files Browse the repository at this point in the history
  • Loading branch information
cmaahs authored and JanDeDobbeleer committed Jan 31, 2020
1 parent a8330cc commit 66fb48b
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion Helpers/Prompt.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,13 @@ function Test-VirtualEnv {

function Get-VirtualEnvName {
if ($env:VIRTUAL_ENV) {
$virtualEnvName = ($env:VIRTUAL_ENV -split '\\')[-1]
if ($PSVersionTable.Platform -eq 'Unix') {
$virtualEnvName = ($env:VIRTUAL_ENV -split '/')[-1]
} elseif ($PSVersionTable.Platform -eq 'Windows') {
$virtualEnvName = ($env:VIRTUAL_ENV -split '\\')[-1]
} else {
$virtualEnvName = $env:VIRTUAL_ENV
}
return $virtualEnvName
} elseif ($Env:CONDA_PROMPT_MODIFIER) {
[regex]::Match($Env:CONDA_PROMPT_MODIFIER, "^\((.*)\)").Captures.Groups[1].Value;
Expand Down

0 comments on commit 66fb48b

Please sign in to comment.