Skip to content

Commit

Permalink
Merge pull request #400 from kabirgaire0/fix/exiftool-session-left-open
Browse files Browse the repository at this point in the history
fixed exiftool session left open after use
  • Loading branch information
yorukot authored Sep 25, 2024
2 parents 5d2c7f7 + 2e39d3c commit e0ca5d8
Showing 1 changed file with 14 additions and 10 deletions.
24 changes: 14 additions & 10 deletions src/internal/model.go
Original file line number Diff line number Diff line change
Expand Up @@ -317,14 +317,18 @@ func (m *model) getFilePanelItems() {
}

func (m model) quitSuperfile() {
// cd on quit
if Config.CdOnQuit {
currentDir := m.fileModel.filePanels[m.filePanelFocusIndex].location
if currentDir == variable.HomeDir {
return
}
// escape single quote
currentDir = strings.ReplaceAll(currentDir, "'", "'\\''")
os.WriteFile(variable.SuperFileStateDir+"/lastdir", []byte("cd '"+currentDir+"'"), 0755)
}
// close exiftool session
if Config.Metadata {
et.Close();
}
// cd on quit
if Config.CdOnQuit {
currentDir := m.fileModel.filePanels[m.filePanelFocusIndex].location
if currentDir == variable.HomeDir {
return
}
// escape single quote
currentDir = strings.ReplaceAll(currentDir, "'", "'\\''")
os.WriteFile(variable.SuperFileStateDir+"/lastdir", []byte("cd '"+currentDir+"'"), 0755)
}
}

0 comments on commit e0ca5d8

Please sign in to comment.