Closed tanoDxyz closed 4 months ago
I think this is expected behavior, as sqlite behaves this way. you should check the existence of an directory before creating any file, if it does not exist create the directory.
for this you can use std::filesystem::create_directories so it creates recursively the directory for you
SQLite::Database(databaseName, SQLite::OPEN_CREATE | SQLite::OPEN_READWRITE)); SQLite::Database(std::filesystem::path("/a/b/abc.db"), SQLite::OPEN_CREATE | SQLite::OPEN_READWRITE);
Whenever i tried to create database on disk and provides a path (relative or absolute) and the directory(s) does not exists i got the following error.
terminate called after throwing an instance of 'SQLite::Exception' what(): unable to open database file
i have to create directory manually.
I am not sure if i am missing something or library behaves in that manner.
I am using clion with mingw and of course windows.