Chris@1519: /* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */ Chris@1519: Chris@1519: /* Chris@1519: Sonic Visualiser Chris@1519: An audio file viewer and annotation editor. Chris@1519: Centre for Digital Music, Queen Mary, University of London. Chris@1519: Chris@1519: This program is free software; you can redistribute it and/or Chris@1519: modify it under the terms of the GNU General Public License as Chris@1519: published by the Free Software Foundation; either version 2 of the Chris@1519: License, or (at your option) any later version. See the file Chris@1519: COPYING included with this distribution for more information. Chris@1519: */ Chris@1519: Chris@1519: #include "RecordDirectory.h" Chris@1519: #include "TempDirectory.h" Chris@1519: Chris@1519: #include Chris@1519: #include Chris@1519: Chris@1519: #include "Debug.h" Chris@1519: Chris@1519: QString Chris@1519: RecordDirectory::getRecordContainerDirectory() Chris@1519: { Chris@1519: QDir parent(TempDirectory::getInstance()->getContainingPath()); Chris@1519: QString subdirname("recorded"); Chris@1519: Chris@1519: if (!parent.mkpath(subdirname)) { Chris@1519: SVCERR << "ERROR: RecordDirectory::getRecordContainerDirectory: Failed to create recorded dir in \"" << parent.canonicalPath() << "\"" << endl; Chris@1519: return ""; Chris@1519: } else { Chris@1519: return parent.filePath(subdirname); Chris@1519: } Chris@1519: } Chris@1519: Chris@1519: QString Chris@1519: RecordDirectory::getRecordDirectory() Chris@1519: { Chris@1519: QDir parent(getRecordContainerDirectory()); Chris@1519: QDateTime now = QDateTime::currentDateTime(); Chris@1519: QString subdirname = QString("%1").arg(now.toString("yyyyMMdd")); Chris@1519: Chris@1519: if (!parent.mkpath(subdirname)) { Chris@1519: SVCERR << "ERROR: RecordDirectory::getRecordDirectory: Failed to create recorded dir in \"" << parent.canonicalPath() << "\"" << endl; Chris@1519: return ""; Chris@1519: } else { Chris@1519: return parent.filePath(subdirname); Chris@1519: } Chris@1519: } Chris@1519: Chris@1519: QString Chris@1519: RecordDirectory::getConvertedAudioDirectory() Chris@1519: { Chris@1519: QDir parent(getRecordContainerDirectory()); Chris@1519: QDateTime now = QDateTime::currentDateTime(); Chris@1519: QString subdirname = "converted"; Chris@1519: Chris@1519: if (!parent.mkpath(subdirname)) { Chris@1519: SVCERR << "ERROR: RecordDirectory::getConvertedAudioDirectory: Failed to create recorded dir in \"" << parent.canonicalPath() << "\"" << endl; Chris@1519: return ""; Chris@1519: } else { Chris@1519: return parent.filePath(subdirname); Chris@1519: } Chris@1519: } Chris@1519: Chris@1519: