58 const std::string& rFileNameBase,
60 : mpCommonStream(nullptr),
61 mpPrivateStream(nullptr),
62 mpCommonArchive(nullptr),
63 mpPrivateArchive(nullptr)
68 std::stringstream common_path;
72 mpCommonStream =
new std::ifstream(common_path.str().c_str(), std::ios::binary);
76 EXCEPTION(
"Cannot load main archive file: " + common_path.str());
83 catch (boost::archive::archive_exception& boost_exception)
85 if (boost_exception.code == boost::archive::archive_exception::unsupported_version)
90 EXCEPTION(
"Could not open Boost archive '" + common_path.str() +
"' because it was written by a more recent Boost. Check process-specific archives too");
95 throw boost_exception;
100 mpPrivateStream =
new std::ifstream(private_path.c_str(), std::ios::binary);
106 EXCEPTION(
"Cannot load secondary archive file: " + private_path);
131 const std::string& rFileNameBase,
133 : mpCommonStream(nullptr),
134 mpPrivateStream(nullptr),
135 mpCommonArchive(nullptr),
136 mpPrivateArchive(nullptr)
141 EXCEPTION(
"Specifying the secondary archive file ID doesn't make sense when writing.");
152 std::stringstream common_path;
158 mpCommonStream =
new std::ofstream(common_path.str().c_str(), std::ios::binary | std::ios::trunc);
162 EXCEPTION(
"Failed to open main archive file for writing: " + common_path.str());
169 mpCommonStream =
new std::ofstream(
"NUL", std::ios::binary | std::ios::trunc);
171 mpCommonStream =
new std::ofstream(
"/dev/null", std::ios::binary | std::ios::trunc);
177 EXCEPTION(
"Failed to open dummy archive file '/dev/null' for writing");
184 mpPrivateStream =
new std::ofstream(private_path.c_str(), std::ios::binary | std::ios::trunc);
190 EXCEPTION(
"Failed to open secondary archive file for writing: " + private_path);