#include #include #include #include #include #include "sqliteinterface.hpp" namespace fs = std::filesystem; using namespace std; void openDB() { fs::path appdata = DEF_APPDATA; if ( ! fs::exists(appdata) ) { error_code ec; fs::create_directories(appdata, ec); cout << ec << endl; } cout << fs::exists(appdata) << endl; sqlite3 *db; fs::path filename = appdata / "ytcpp.db"; int rc = sqlite3_open(filename.c_str(), &db); if( rc ) { char errmsg[] = "Can't open database: "; strcat(errmsg, sqlite3_errmsg(db)); throw runtime_error(errmsg); } else { std::cout << "Opened database successfully" << std::endl; } sqlite3_close(db); }