Skip to content

Commit

Permalink
Merge pull request #218 from booth-w/main
Browse files Browse the repository at this point in the history
Added quotes arround dir in lastdir to support special characters
  • Loading branch information
yorukot authored May 30, 2024
2 parents ecfa137 + 990d147 commit 4d353ef
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/internal/model.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"log"
"os"
"path/filepath"
"strings"
"time"

"github.com/barasher/go-exiftool"
Expand Down Expand Up @@ -139,7 +140,9 @@ func (m model) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
if currentDir == varibale.HomeDir {
return m, tea.Quit
}
os.WriteFile(varibale.SuperFileStateDir+"/lastdir", []byte("cd "+currentDir), 0755)
// escape single quote
currentDir = strings.ReplaceAll(currentDir, "'", "'\\''")
os.WriteFile(varibale.SuperFileStateDir+"/lastdir", []byte("cd '"+currentDir+"'"), 0755)
}
return m, tea.Quit
}
Expand Down

0 comments on commit 4d353ef

Please sign in to comment.