Commit d33ddd5f authored by Frerich Raabe's avatar Frerich Raabe

- The debug output was right, but the code was wrong: check the token *value*

  for directory separators, not the token itself.
- Don't break if "Needs Value" is checked and a token value contains only
  slashes.

svn path=/trunk/kdemultimedia/juk/; revision=248892
parent 125598f1
......@@ -85,22 +85,24 @@ FileRenamer::FileRenamer(const PlaylistItem *item)
rename(item);
}
QString FileRenamer::expandToken(TokenType type, const QString &value) const
QString FileRenamer::expandToken(TokenType type, const QString &value_) const
{
const bool needValue = m_cfg.tokenNeedsValue(type);
if(needValue && value.isEmpty())
return QString();
QString value = value_;
QString token = m_cfg.getToken(type);
token.replace("%s", value);
if(token.find(QDir::separator()) > -1) {
if(value.find(QDir::separator()) > -1) {
kdWarning() << "Found token value with dir separators!" << endl;
token.replace(QDir::separator(), "");
value.replace(QDir::separator(), "");
}
if((needValue) && value.isEmpty())
return QString();
token.replace("%s", value);
return token;
}
void FileRenamer::rename(const PlaylistItem *item)
{
if(item == 0 || item->tag() == 0)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment