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

Commit 66fb48b

Browse files
cmaahsJanDeDobbeleer
authored andcommitted
Unix separator for VirtualEnv Prompt
1 parent a8330cc commit 66fb48b

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

Helpers/Prompt.ps1

+7-1
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,13 @@ function Test-VirtualEnv {
163163

164164
function Get-VirtualEnvName {
165165
if ($env:VIRTUAL_ENV) {
166-
$virtualEnvName = ($env:VIRTUAL_ENV -split '\\')[-1]
166+
if ($PSVersionTable.Platform -eq 'Unix') {
167+
$virtualEnvName = ($env:VIRTUAL_ENV -split '/')[-1]
168+
} elseif ($PSVersionTable.Platform -eq 'Windows') {
169+
$virtualEnvName = ($env:VIRTUAL_ENV -split '\\')[-1]
170+
} else {
171+
$virtualEnvName = $env:VIRTUAL_ENV
172+
}
167173
return $virtualEnvName
168174
} elseif ($Env:CONDA_PROMPT_MODIFIER) {
169175
[regex]::Match($Env:CONDA_PROMPT_MODIFIER, "^\((.*)\)").Captures.Groups[1].Value;

0 commit comments

Comments
 (0)