From c485b4bc4c5ca2e80b4151a439116ea8cda89cc7 Mon Sep 17 00:00:00 2001 From: Leonardo de Moura Date: Mon, 30 Dec 2013 18:20:36 -0800 Subject: [PATCH] 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 --- src/kernel/environment.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/kernel/environment.cpp b/src/kernel/environment.cpp index 360ab31743..c4f0f77912 100644 --- a/src/kernel/environment.cpp +++ b/src/kernel/environment.cpp @@ -553,7 +553,7 @@ void environment_cell::set_trusted_imported(bool flag) { static char const * g_olean_header = "oleanfile"; static char const * g_olean_end_file = "EndFile"; void environment_cell::export_objects(std::string const & fname) { - std::ofstream out(fname); + std::ofstream out(fname, std::ofstream::binary); serializer s(out); s << g_olean_header << LEAN_VERSION_MAJOR << LEAN_VERSION_MINOR; 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 const & mod_name) { if (!mod_name || mark_imported_core(fname)) { - std::ifstream in(fname); + std::ifstream in(fname, std::ifstream::binary); if (!in.good()) throw exception(sstream() << "failed to open file '" << fname << "'"); deserializer d(in);