mirror of
https://github.com/JanDeDobbeleer/oh-my-posh.git
synced 2025-03-05 20:49:04 -08:00
fix(scm): convert to Windows path with /
instead of \
This commit is contained in:
parent
7e141fb5ec
commit
0b77995d80
|
@ -106,7 +106,7 @@ func (env *ShellEnvironment) InWSLSharedDrive() bool {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (env *ShellEnvironment) ConvertToWindowsPath(path string) string {
|
func (env *ShellEnvironment) ConvertToWindowsPath(path string) string {
|
||||||
windowsPath, err := env.RunCommand("wslpath", "-w", path)
|
windowsPath, err := env.RunCommand("wslpath", "-m", path)
|
||||||
if err == nil {
|
if err == nil {
|
||||||
return windowsPath
|
return windowsPath
|
||||||
}
|
}
|
||||||
|
|
|
@ -228,7 +228,7 @@ func (env *ShellEnvironment) InWSLSharedDrive() bool {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (env *ShellEnvironment) ConvertToWindowsPath(path string) string {
|
func (env *ShellEnvironment) ConvertToWindowsPath(path string) string {
|
||||||
return path
|
return strings.ReplaceAll(path, `\`, "/")
|
||||||
}
|
}
|
||||||
|
|
||||||
func (env *ShellEnvironment) ConvertToLinuxPath(path string) string {
|
func (env *ShellEnvironment) ConvertToLinuxPath(path string) string {
|
||||||
|
|
|
@ -94,10 +94,10 @@ func (s *scm) FileContents(folder, file string) string {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *scm) convertToWindowsPath(path string) string {
|
func (s *scm) convertToWindowsPath(path string) string {
|
||||||
if !s.IsWslSharedPath {
|
if s.env.GOOS() == environment.WINDOWS || s.IsWslSharedPath {
|
||||||
return path
|
|
||||||
}
|
|
||||||
return s.env.ConvertToWindowsPath(path)
|
return s.env.ConvertToWindowsPath(path)
|
||||||
|
}
|
||||||
|
return path
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *scm) convertToLinuxPath(path string) string {
|
func (s *scm) convertToLinuxPath(path string) string {
|
||||||
|
|
|
@ -81,7 +81,7 @@ func (s *Svn) shouldDisplay() bool {
|
||||||
s.workingDir = Svndir.Path
|
s.workingDir = Svndir.Path
|
||||||
s.rootDir = Svndir.Path
|
s.rootDir = Svndir.Path
|
||||||
// convert the worktree file path to a windows one when in wsl 2 shared folder
|
// convert the worktree file path to a windows one when in wsl 2 shared folder
|
||||||
s.realDir = strings.TrimSuffix(s.convertToWindowsPath(Svndir.Path), ".svn")
|
s.realDir = strings.TrimSuffix(s.convertToWindowsPath(Svndir.Path), "/.svn")
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
// handle worktree
|
// handle worktree
|
||||||
|
|
Loading…
Reference in a new issue