handle relative paths in 'toggle' command
This commit is contained in:
parent
7174b7e307
commit
9539daf8df
8
eval.go
8
eval.go
@ -711,11 +711,15 @@ func (e *callExpr) eval(app *app, args []string) {
|
|||||||
if len(e.args) == 0 {
|
if len(e.args) == 0 {
|
||||||
app.nav.toggle()
|
app.nav.toggle()
|
||||||
} else {
|
} else {
|
||||||
|
curr := app.nav.currDir()
|
||||||
for _, path := range e.args {
|
for _, path := range e.args {
|
||||||
if _, err := os.Lstat(path); err == nil {
|
if !filepath.IsAbs(path) {
|
||||||
|
path = filepath.Join(curr.path, path)
|
||||||
|
}
|
||||||
|
if _, err := os.Lstat(path); !os.IsNotExist(err) {
|
||||||
app.nav.toggleSelection(path)
|
app.nav.toggleSelection(path)
|
||||||
} else {
|
} else {
|
||||||
log.Printf("toggle: %s", err)
|
app.ui.echoerrf("toggle: %s", err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user