throw on failed writing and port fs namespace changes from oxen-core

This commit is contained in:
Jeff Becker 2021-04-16 14:47:17 -04:00
parent 6cde9062b5
commit a0d3ab125a
No known key found for this signature in database
GPG Key ID: F357B3B42F6F9B05
2 changed files with 10 additions and 2 deletions

View File

@ -70,7 +70,8 @@ main(int argc, char* argv[])
std::string data{ss.str()};
if (data[0] == 'l' or data[0] == 'd')
{
std::ofstream ofs{outputfile};
fs::ofstream ofs{outputfile};
ofs.exceptions(fs::ofstream::failbit);
ofs << data;
return 0;
}

View File

@ -14,7 +14,14 @@
namespace fs = ghc::filesystem;
#else
#include <filesystem>
namespace fs = std::filesystem;
namespace fs
{
using namespace std::filesystem;
using ifstream = std::ifstream;
using ofstream = std::ofstream;
using fstream = std::fstream;
} // namespace fs
#endif
#ifndef _MSC_VER