mirror of
https://github.com/JanDeDobbeleer/oh-my-posh.git
synced 2024-11-10 13:04:04 -08:00
parent
3bc9e83814
commit
35edf3a93d
|
@ -99,6 +99,11 @@ func (pt *Path) setPaths() {
|
|||
}
|
||||
// ensure a clean path
|
||||
pt.root, pt.relative = pt.replaceMappedLocations()
|
||||
// this is a full replacement of the parent
|
||||
if len(pt.root) == 0 {
|
||||
pt.pwd = pt.relative
|
||||
return
|
||||
}
|
||||
pathSeparator := pt.env.PathSeparator()
|
||||
if !strings.HasSuffix(pt.root, pathSeparator) && len(pt.relative) > 0 {
|
||||
pt.pwd = pt.root + pathSeparator + pt.relative
|
||||
|
|
|
@ -1350,6 +1350,7 @@ func TestReplaceMappedLocations(t *testing.T) {
|
|||
Pwd string
|
||||
Expected string
|
||||
}{
|
||||
{Pwd: "/c/l/k/f", Expected: "f"},
|
||||
{Pwd: "/f/g/h", Expected: "/f/g/h"},
|
||||
{Pwd: "/f/g/h/e", Expected: "^/e"},
|
||||
{Pwd: "/a/b/c/d", Expected: "#"},
|
||||
|
@ -1369,6 +1370,7 @@ func TestReplaceMappedLocations(t *testing.T) {
|
|||
MappedLocations: map[string]string{
|
||||
"/a/b/c/d": "#",
|
||||
"/f/g/h/*": "^",
|
||||
"/c/l/k/*": "",
|
||||
},
|
||||
},
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue