comparison base/RecordDirectory.cpp @ 1527:710e6250a401 zoom

Merge from default branch
author Chris Cannam
date Mon, 17 Sep 2018 13:51:14 +0100
parents fbe8afdfa8a6
children
comparison
equal deleted inserted replaced
1324:d4a28d1479a8 1527:710e6250a401
1 /* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */
2
3 /*
4 Sonic Visualiser
5 An audio file viewer and annotation editor.
6 Centre for Digital Music, Queen Mary, University of London.
7
8 This program is free software; you can redistribute it and/or
9 modify it under the terms of the GNU General Public License as
10 published by the Free Software Foundation; either version 2 of the
11 License, or (at your option) any later version. See the file
12 COPYING included with this distribution for more information.
13 */
14
15 #include "RecordDirectory.h"
16 #include "TempDirectory.h"
17
18 #include <QDir>
19 #include <QDateTime>
20
21 #include "Debug.h"
22
23 QString
24 RecordDirectory::getRecordContainerDirectory()
25 {
26 QDir parent(TempDirectory::getInstance()->getContainingPath());
27 QString subdirname("recorded");
28
29 if (!parent.mkpath(subdirname)) {
30 SVCERR << "ERROR: RecordDirectory::getRecordContainerDirectory: Failed to create recorded dir in \"" << parent.canonicalPath() << "\"" << endl;
31 return "";
32 } else {
33 return parent.filePath(subdirname);
34 }
35 }
36
37 QString
38 RecordDirectory::getRecordDirectory()
39 {
40 QDir parent(getRecordContainerDirectory());
41 QDateTime now = QDateTime::currentDateTime();
42 QString subdirname = QString("%1").arg(now.toString("yyyyMMdd"));
43
44 if (!parent.mkpath(subdirname)) {
45 SVCERR << "ERROR: RecordDirectory::getRecordDirectory: Failed to create recorded dir in \"" << parent.canonicalPath() << "\"" << endl;
46 return "";
47 } else {
48 return parent.filePath(subdirname);
49 }
50 }
51
52 QString
53 RecordDirectory::getConvertedAudioDirectory()
54 {
55 QDir parent(getRecordContainerDirectory());
56 QDateTime now = QDateTime::currentDateTime();
57 QString subdirname = "converted";
58
59 if (!parent.mkpath(subdirname)) {
60 SVCERR << "ERROR: RecordDirectory::getConvertedAudioDirectory: Failed to create recorded dir in \"" << parent.canonicalPath() << "\"" << endl;
61 return "";
62 } else {
63 return parent.filePath(subdirname);
64 }
65 }
66
67