Fix a bug that when saving the queue, the current song is not saved

This commit is contained in:
tramhao 2021-01-29 00:14:50 +08:00
parent a25a584416
commit 914e072089

View File

@ -202,13 +202,17 @@ func (q *Queue) saveQueue() error {
songPaths := q.getItems()
var content strings.Builder
songPath := gomu.player.currentSong.path
hashed := sha1Hex(getName(songPath))
content.WriteString(hashed + "\n")
for _, songPath := range songPaths {
// hashed song name is easier to search through
hashed := sha1Hex(getName(songPath))
content.WriteString(hashed + "\n")
}
savedPath := expandTilde(q.savedQueuePath)
err := ioutil.WriteFile(savedPath, []byte(content.String()), 0644)