Small patch to fix creating directory if it doesn't already exist

This commit is contained in:
David Allen 2022-07-30 12:53:08 -05:00
parent c28ee29250
commit d4447a1ffa

View file

@ -15,9 +15,10 @@ namespace gdpm::cache{
char *errmsg; char *errmsg;
/* Check and make sure directory is created before attempting to open */ /* Check and make sure directory is created before attempting to open */
if(!std::filesystem::exists(cache_path)){ using namespace fs = std::filesystem;
if(!fs::exists(fs::path(cache_path).parent_path())){
log::info("Creating cache directories...{}", cache_path); log::info("Creating cache directories...{}", cache_path);
std::filesystem::create_directories(cache_path); fs::create_directories(cache_path);
} }
int rc = sqlite3_open(cache_path.c_str(), &db); int rc = sqlite3_open(cache_path.c_str(), &db);