blob: 377963b10c50d9094aaf181ea0d9d5ab3a736fc9 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
|
/*
* Oreka -- A media capture and retrieval platform
*
* Copyright (C) 2005, orecx LLC
*
* http://www.orecx.com
*
* This program is free software, distributed under the terms of
* the GNU General Public License.
* Please refer to http://www.gnu.org/copyleft/gpl.html
*
*/
#include "AudioFile.h"
#include "ace/OS_NS_unistd.h"
void AudioFile::Open(fileOpenModeEnum mode, bool stereo , int sampleRate)
{
Open(m_filename, mode, stereo, sampleRate);
}
void AudioFile::RecursiveMkdir(CStdString& path)
{
int position = 0;
bool done = false;
while (!done)
{
position = path.Find('/', position+1);
if (position == -1)
{
done = true;
}
else
{
CStdString level = path.Left(position);
ACE_OS::mkdir((PCSTR)level);
}
}
}
void AudioFile::MoveOrig()
{
CStdString newName = m_filename + ".orig";
if (ACE_OS::rename((PCSTR)m_filename, (PCSTR)newName) == 0)
{
m_filename = newName;
}
else
{
throw(CStdString("AudioFile::MoveOrig: could not rename file:" + m_filename));
}
}
void AudioFile::Delete()
{
ACE_OS::unlink((PCSTR)m_filename);
}
|