Replace more invalid FAT32 characters in filenames. Fixes issue #799

This commit is contained in:
David Sansome 2010-09-25 15:04:58 +00:00
parent 7539c3b222
commit 625e4dffdb
2 changed files with 9 additions and 3 deletions

View File

@ -26,6 +26,10 @@ const QStringList OrganiseFormat::kKnownTags = QStringList()
<< "composer" << "track" << "disc" << "bpm" << "year" << "genre"
<< "comment" << "length" << "bitrate" << "samplerate" << "extension";
// From http://en.wikipedia.org/wiki/8.3_filename#Directory_table
const char* OrganiseFormat::kInvalidFatCharacters = "\"*/\\:<>?|";
const int OrganiseFormat::kInvalidFatCharactersCount = strlen(OrganiseFormat::kInvalidFatCharacters);
const QRgb OrganiseFormat::SyntaxHighlighter::kValidTagColorLight = qRgb(64, 64, 255);
const QRgb OrganiseFormat::SyntaxHighlighter::kInvalidTagColorLight = qRgb(255, 64, 64);
const QRgb OrganiseFormat::SyntaxHighlighter::kBlockColorLight = qRgb(230, 230, 230);
@ -152,9 +156,9 @@ QString OrganiseFormat::TagValue(const QString &tag, const Song &song) const {
value.prepend('0');
// Replace characters that really shouldn't be in paths
value.replace('/', '_');
value.replace('\\', '_');
value.replace('?', '_');
for (int i=0 ; i<kInvalidFatCharactersCount ; ++i) {
value.replace(kInvalidFatCharacters[i], '_');
}
return value;
}

View File

@ -29,6 +29,8 @@ public:
static const char* kTagPattern;
static const char* kBlockPattern;
static const QStringList kKnownTags;
static const char* kInvalidFatCharacters;
static const int kInvalidFatCharactersCount;
QString format() const { return format_; }
bool replace_non_ascii() const { return replace_non_ascii_; }