Respect symlinks when tagging files (#1997)
This commit is contained in:
1 parent
7507be4d04
commit
fe3a97c5d0
3 files changed
+12
-2
No files matched your search
@@ -31,6 +31,14 @@ func replaceTilde(s string) string {
|
|||||||
return s
|
return s
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func evalSymlinks(path string) string {
|
||||||
|
if target, err := filepath.EvalSymlinks(path); err == nil {
|
||||||
|
return target
|
||||||
|
}
|
||||||
|
|
||||||
|
return path
|
||||||
|
}
|
||||||
|
|
||||||
func runeSliceWidth(rs []rune) int {
|
func runeSliceWidth(rs []rune) int {
|
||||||
w := 0
|
w := 0
|
||||||
for _, r := range rs {
|
for _, r := range rs {
|
||||||
|
|||||||
@@ -1161,6 +1161,8 @@ func (nav *nav) toggle() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (nav *nav) tagToggleSelection(path string, tag string) {
|
func (nav *nav) tagToggleSelection(path string, tag string) {
|
||||||
|
path = evalSymlinks(path)
|
||||||
|
|
||||||
if _, ok := nav.tags[path]; ok {
|
if _, ok := nav.tags[path]; ok {
|
||||||
delete(nav.tags, path)
|
delete(nav.tags, path)
|
||||||
} else {
|
} else {
|
||||||
@@ -1196,7 +1198,7 @@ func (nav *nav) tag(tag string) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
for _, path := range list {
|
for _, path := range list {
|
||||||
nav.tags[path] = tag
|
nav.tags[evalSymlinks(path)] = tag
|
||||||
}
|
}
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
|
|||||||
Reference in new issue
Block a user