do not follow symlinks on exit
This commit is contained in:
parent
fac1c9e8de
commit
bc4c3c127b
16
app.go
16
app.go
@ -34,6 +34,22 @@ func (app *App) handleInp() {
|
|||||||
for {
|
for {
|
||||||
if gExitFlag {
|
if gExitFlag {
|
||||||
log.Print("bye!")
|
log.Print("bye!")
|
||||||
|
|
||||||
|
if gLastDirPath != "" {
|
||||||
|
f, err := os.Create(gLastDirPath)
|
||||||
|
if err != nil {
|
||||||
|
log.Print(err)
|
||||||
|
}
|
||||||
|
defer f.Close()
|
||||||
|
|
||||||
|
dir := app.nav.currDir()
|
||||||
|
|
||||||
|
_, err = f.WriteString(dir.path)
|
||||||
|
if err != nil {
|
||||||
|
log.Print(err)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
e := app.ui.getExpr()
|
e := app.ui.getExpr()
|
||||||
|
21
main.go
21
main.go
@ -18,6 +18,7 @@ var (
|
|||||||
|
|
||||||
var (
|
var (
|
||||||
gExitFlag bool
|
gExitFlag bool
|
||||||
|
gLastDirPath string
|
||||||
gSelectionPath string
|
gSelectionPath string
|
||||||
gSocketPath string
|
gSocketPath string
|
||||||
gLogPath string
|
gLogPath string
|
||||||
@ -62,7 +63,7 @@ func startServer() {
|
|||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
serverMode := flag.Bool("server", false, "start server (automatic)")
|
serverMode := flag.Bool("server", false, "start server (automatic)")
|
||||||
lastDirPath := flag.String("last-dir-path", "", "path to the file to write the last dir on exit (to use for cd)")
|
flag.StringVar(&gLastDirPath, "last-dir-path", "", "path to the file to write the last dir on exit (to use for cd)")
|
||||||
flag.StringVar(&gSelectionPath, "selection-path", "", "path to the file to write selected files on exit (to use as open file dialog)")
|
flag.StringVar(&gSelectionPath, "selection-path", "", "path to the file to write selected files on exit (to use as open file dialog)")
|
||||||
|
|
||||||
flag.Parse()
|
flag.Parse()
|
||||||
@ -78,22 +79,4 @@ func main() {
|
|||||||
|
|
||||||
client()
|
client()
|
||||||
}
|
}
|
||||||
|
|
||||||
if *lastDirPath != "" {
|
|
||||||
f, err := os.Create(*lastDirPath)
|
|
||||||
if err != nil {
|
|
||||||
log.Print(err)
|
|
||||||
}
|
|
||||||
defer f.Close()
|
|
||||||
|
|
||||||
wd, err := os.Getwd()
|
|
||||||
if err != nil {
|
|
||||||
log.Print(err)
|
|
||||||
}
|
|
||||||
|
|
||||||
_, err = f.WriteString(wd)
|
|
||||||
if err != nil {
|
|
||||||
log.Print(err)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user