#include #include "blueprints.hpp" #include #include #include namespace kel { saw::error_or write_to_file( std::string_view file_path, std::string_view file_content ){ namespace fs = std::filesystem; try { auto fpath = fs::path(file_path); if(fpath.has_parent_path()){ fs::create_directories(fs::path(fpath).parent_path()); } std::ofstream out(fpath, std::ios::binary); if(not out){ return saw::make_error("Couldn't create file"); } out.write(file_content.data(), static_cast(file_content.size())); if(not out){ return saw::make_error("Couldn't write to file"); } }catch(const std::exception& e){ (void) e; return saw::make_error("Couldn't create file somehow"); } return saw::make_void(); } saw::error_or kel_main(int argc, char** argv){ (void) argc; (void) argv; namespace fs = std::filesystem; try { fs::path cwd = fs::current_path(); std::cout << "\nCurrent working is directory: " << cwd << "\n\n"; } catch (const std::exception& e) { return saw::make_error("Couldn't get the working directory"); } { std::string confirm; std::cout << "Are you sure to proceed? Type 'yes' to continue: "; std::getline(std::cin, confirm); if (confirm != "yes") { std::cout<<"Didn't type \"yes\". Aborting..."<