#include <sndfile.h>
#include "file_group.h"
#include "exceptions.h"
+#include "cross.h"
using std::vector;
using std::cout;
+FileGroup::FileGroup ()
+ : _current_path (0)
+ , _current_file (0)
+{
+
+}
+
FileGroup::FileGroup (boost::filesystem::path p)
: _current_path (0)
, _current_file (0)
}
}
+void
+FileGroup::set_paths (vector<boost::filesystem::path> const & p)
+{
+ _paths = p;
+ ensure_open_path (0);
+ seek (0, SEEK_SET);
+}
/** Ensure that the given path index in the content is the _current_file */
void
}
_current_path = p;
- _current_file = fopen (_paths[_current_path].string().c_str(), "rb");
+ _current_file = fopen_boost (_paths[_current_path], "rb");
if (_current_file == 0) {
throw OpenFileError (_paths[_current_path]);
}
for (size_t i = 0; i < _current_path; ++i) {
full_pos += boost::filesystem::file_size (_paths[i]);
}
+#ifdef DCPOMATIC_WINDOWS
+ full_pos += _ftelli64 (_current_file);
+#else
full_pos += ftell (_current_file);
+#endif
full_pos += pos;
break;
case SEEK_END:
}
ensure_open_path (i);
- fseek (_current_file, sub_pos, SEEK_SET);
+ dcpomatic_fseek (_current_file, sub_pos, SEEK_SET);
return full_pos;
}