diff --git a/include/Track.h b/include/Track.h index f3b6c5e4cdb..bc9f161a9b3 100644 --- a/include/Track.h +++ b/include/Track.h @@ -72,6 +72,8 @@ const int DEFAULT_TRACK_HEIGHT = 32; const int TCO_BORDER_WIDTH = 2; +char const *const FILENAME_FILTER = "[\\0000-\x1f\"*/:<>?\\\\|\x7f]"; + class TrackContentObject : public Model, public JournallingObject { diff --git a/src/core/RenderManager.cpp b/src/core/RenderManager.cpp index 478aa46e73d..7b9c489e1cc 100644 --- a/src/core/RenderManager.cpp +++ b/src/core/RenderManager.cpp @@ -203,7 +203,7 @@ QString RenderManager::pathForTrack(const Track *track, int num) { QString extension = ProjectRenderer::getFileExtensionFromFormat( m_format ); QString name = track->name(); - name = name.remove(QRegExp("[^a-zA-Z]")); + name = name.remove(QRegExp(FILENAME_FILTER)); name = QString( "%1_%2%3" ).arg( num ).arg( name ).arg( extension ); return QDir(m_outputPath).filePath(name); } diff --git a/src/tracks/InstrumentTrack.cpp b/src/tracks/InstrumentTrack.cpp index 98a691a9a42..3f0c59b7d18 100644 --- a/src/tracks/InstrumentTrack.cpp +++ b/src/tracks/InstrumentTrack.cpp @@ -1615,7 +1615,7 @@ void InstrumentTrackWindow::saveSettingsBtnClicked() sfd.setDirectory( presetRoot + m_track->instrumentName() ); sfd.setFileMode( FileDialog::AnyFile ); QString fname = m_track->name(); - sfd.selectFile( fname.remove(QRegExp("[^a-zA-Z0-9_\\-\\d\\s]")) ); + sfd.selectFile(fname.remove(QRegExp(FILENAME_FILTER))); sfd.setDefaultSuffix( "xpf"); if( sfd.exec() == QDialog::Accepted &&