diff --git a/src/tag_editor.cpp b/src/tag_editor.cpp index ffedb15a..ab391d85 100644 --- a/src/tag_editor.cpp +++ b/src/tag_editor.cpp @@ -1191,7 +1191,7 @@ Song::SetFunction TagEditor::IntoSetFunction(char c) } } -std::string TagEditor::GenerateFilename(const Song &s, std::string &pattern) +std::string TagEditor::GenerateFilename(const Song &s, const std::string &pattern) { std::string result = s.toString(pattern); EscapeUnallowedChars(result); @@ -1409,11 +1409,11 @@ void TagEditor::DealWithFilenames(SongList &v) } else { - const std::string &file = s.GetName(); + std::string file = s.GetName(); size_t last_dot = file.rfind("."); std::string extension = file.substr(last_dot); basic_buffer new_file; - new_file << TO_WSTRING(GenerateFilename(s, Config.pattern)); + new_file << TO_WSTRING(GenerateFilename(s, "{" + Config.pattern + "}")); if (new_file.Str().empty()) { if (preview) diff --git a/src/tag_editor.h b/src/tag_editor.h index e6e9e64c..44190f7a 100644 --- a/src/tag_editor.h +++ b/src/tag_editor.h @@ -115,7 +115,7 @@ class TagEditor : public Screen static void GetPatternList(); static void SavePatternList(); static MPD::Song::SetFunction IntoSetFunction(char); - static std::string GenerateFilename(const MPD::Song &, std::string &); + static std::string GenerateFilename(const MPD::Song &, const std::string &); static std::string ParseFilename(MPD::Song &, std::string, bool); static void DealWithFilenames(MPD::SongList &);