Replace ? characters when copying files to devices (since they're invalid on FAT32 filesystems), and check the return value of QDir::mkpath. Fixes issue #721.

This commit is contained in:
David Sansome 2010-09-18 10:06:30 +00:00
parent 38cfedb3d2
commit e95c4979f8
2 changed files with 6 additions and 1 deletions

View File

@ -32,8 +32,12 @@ bool FilesystemMusicStorage::CopyToStorage(const CopyJob& job) {
return true;
// Create directories as required
const QString dest_directory = dest_filename.section('/', 0, -2);
QDir dir;
dir.mkpath(dest_filename.section('/', 0, -2));
if (!dir.mkpath(dest_directory)) {
qWarning() << "Failed to create directory" << dest_directory;
return false;
}
// Remove the destination file if it exists and we want to overwrite
if (job.overwrite_ && QFile::exists(dest_filename))

View File

@ -154,6 +154,7 @@ QString OrganiseFormat::TagValue(const QString &tag, const Song &song) const {
// Replace characters that really shouldn't be in paths
value.replace('/', '_');
value.replace('\\', '_');
value.replace('?', '_');
return value;
}