Merge 1.70.0-hotfix branch into master.
[dcpomatic.git] / src / lib / file_group.cc
index 9c206514152acc077d84419a4afafe846283c4e3..9d042554c5b8c0649385456895d0358d813a7b0c 100644 (file)
@@ -21,6 +21,7 @@
 #include <sndfile.h>
 #include "file_group.h"
 #include "exceptions.h"
+#include "cross.h"
 
 using std::vector;
 using std::cout;
@@ -78,7 +79,7 @@ FileGroup::ensure_open_path (size_t p) const
        }
 
        _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]);
        }
@@ -99,7 +100,11 @@ FileGroup::seek (int64_t pos, int whence) const
                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:
@@ -124,7 +129,7 @@ FileGroup::seek (int64_t pos, int whence) const
        }
 
        ensure_open_path (i);
-       fseek (_current_file, sub_pos, SEEK_SET);
+       dcpomatic_fseek (_current_file, sub_pos, SEEK_SET);
        return full_pos;
 }