# HG changeset patch # User Chris Cannam # Date 1444831735 -3600 # Node ID b84d9b512dbd969c05cd64fa0a2c34f678ab4118 # Parent 9a125d1c8a2254411fa4fb27ddc45d1918ab469f Put recorded files in subdirectories by date diff -r 9a125d1c8a22 -r b84d9b512dbd audio/AudioRecordTarget.cpp --- a/audio/AudioRecordTarget.cpp Wed Oct 14 14:52:46 2015 +0100 +++ b/audio/AudioRecordTarget.cpp Wed Oct 14 15:08:55 2015 +0100 @@ -98,10 +98,26 @@ } QString +AudioRecordTarget::getRecordContainerFolder() +{ + QDir parent(TempDirectory::getInstance()->getContainingPath()); + QString subdirname("recorded"); + + if (!parent.mkpath(subdirname)) { + cerr << "ERROR: AudioRecordTarget::getRecordContainerFolder: Failed to create recorded dir in \"" << parent.canonicalPath() << "\"" << endl; + return ""; + } else { + return parent.filePath(subdirname); + } +} + +QString AudioRecordTarget::getRecordFolder() { - QDir parent(TempDirectory::getInstance()->getContainingPath()); - QString subdirname = "recorded"; //!!! tr? + QDir parent(getRecordContainerFolder()); + QDateTime now = QDateTime::currentDateTime(); + QString subdirname = QString("%1").arg(now.toString("yyyyMMdd")); + if (!parent.mkpath(subdirname)) { cerr << "ERROR: AudioRecordTarget::getRecordFolder: Failed to create recorded dir in \"" << parent.canonicalPath() << "\"" << endl; return ""; diff -r 9a125d1c8a22 -r b84d9b512dbd audio/AudioRecordTarget.h --- a/audio/AudioRecordTarget.h Wed Oct 14 14:52:46 2015 +0100 +++ b/audio/AudioRecordTarget.h Wed Oct 14 15:08:55 2015 +0100 @@ -51,6 +51,7 @@ virtual void audioProcessingOverload() { } + QString getRecordContainerFolder(); QString getRecordFolder(); bool isRecording() const { return m_recording; }