#include "dcpomatic_assert.h"
#include "exceptions.h"
#include "file_group.h"
+#include <dcp/filesystem.h>
#include <sndfile.h>
#include <cstdio>
if (!_current_file) {
throw OpenFileError (_paths[_current_path], errno, OpenFileError::READ);
}
- _current_size = boost::filesystem::file_size (_paths[_current_path]);
+ _current_size = dcp::filesystem::file_size(_paths[_current_path]);
}
size_t i = 0;
int64_t sub_pos = _position;
while (i < _paths.size()) {
- boost::uintmax_t len = boost::filesystem::file_size (_paths[i]);
+ boost::uintmax_t len = dcp::filesystem::file_size(_paths[i]);
if (sub_pos < int64_t(len)) {
break;
}
/** Try to read some data from the current position into a buffer.
* @param buffer Buffer to write data into.
* @param amount Number of bytes to read.
- * @return Number of bytes read.
*/
-int
+FileGroup::Result
FileGroup::read (uint8_t* buffer, int amount) const
{
DCPOMATIC_ASSERT (_current_file);
if (eof) {
/* See if there is another file to use */
if ((_current_path + 1) >= _paths.size()) {
- break;
+ return { read, true };
}
ensure_open_path (_current_path + 1);
}
}
- return read;
+ return { read, false };
}
{
int64_t len = 0;
for (size_t i = 0; i < _paths.size(); ++i) {
- len += boost::filesystem::file_size (_paths[i]);
+ len += dcp::filesystem::file_size(_paths[i]);
}
return len;