fix(kernel/environment): binary file reader, force the file to be read in binary mode
We need this flag to be able to read the file on Windows. Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
This commit is contained in:
parent
1f6e959139
commit
c485b4bc4c
1 changed files with 2 additions and 2 deletions
|
@ -553,7 +553,7 @@ void environment_cell::set_trusted_imported(bool flag) {
|
||||||
static char const * g_olean_header = "oleanfile";
|
static char const * g_olean_header = "oleanfile";
|
||||||
static char const * g_olean_end_file = "EndFile";
|
static char const * g_olean_end_file = "EndFile";
|
||||||
void environment_cell::export_objects(std::string const & fname) {
|
void environment_cell::export_objects(std::string const & fname) {
|
||||||
std::ofstream out(fname);
|
std::ofstream out(fname, std::ofstream::binary);
|
||||||
serializer s(out);
|
serializer s(out);
|
||||||
s << g_olean_header << LEAN_VERSION_MAJOR << LEAN_VERSION_MINOR;
|
s << g_olean_header << LEAN_VERSION_MAJOR << LEAN_VERSION_MINOR;
|
||||||
auto it = begin_objects();
|
auto it = begin_objects();
|
||||||
|
@ -579,7 +579,7 @@ void environment_cell::export_objects(std::string const & fname) {
|
||||||
|
|
||||||
bool environment_cell::load_core(std::string const & fname, io_state const & ios, optional<std::string> const & mod_name) {
|
bool environment_cell::load_core(std::string const & fname, io_state const & ios, optional<std::string> const & mod_name) {
|
||||||
if (!mod_name || mark_imported_core(fname)) {
|
if (!mod_name || mark_imported_core(fname)) {
|
||||||
std::ifstream in(fname);
|
std::ifstream in(fname, std::ifstream::binary);
|
||||||
if (!in.good())
|
if (!in.good())
|
||||||
throw exception(sstream() << "failed to open file '" << fname << "'");
|
throw exception(sstream() << "failed to open file '" << fname << "'");
|
||||||
deserializer d(in);
|
deserializer d(in);
|
||||||
|
|
Loading…
Reference in a new issue