fix renaming local files in browser

This commit is contained in:
unK
2008-10-27 21:15:36 +01:00
parent db6eb9bc38
commit 6f3276dffa

View File

@@ -39,6 +39,7 @@ extern Menu<Song> *mPlaylist;
extern Menu<string> *mTagEditor;
extern Window *wFooter;
extern Window *wPrev;
SongSetFunction IntoSetFunction(mpd_TagItems tag)
{
@@ -247,6 +248,8 @@ bool WriteTags(Song &s)
new_name += Config.mpd_music_dir;
new_name += s.GetDirectory() + "/" + s.GetNewName();
if (rename(old_name.c_str(), new_name.c_str()) == 0 && !file_is_from_db)
{
if (wPrev == mPlaylist)
{
// if we rename local file, it won't get updated
// so just remove it from playlist and add again
@@ -260,6 +263,9 @@ bool WriteTags(Song &s)
Mpd->Move(s.GetPosition(), pos);
}
}
else // only mBrowser
s.SetFile(new_name);
}
}
return true;
}