Pastebin

New pastes are no longer accepted · Stats

Latest Pastes

SQLite DB fix


#ifdef WIN32
{
            DWORD dbFileAttr = GetFileAttributes(host.c_str());
            if(dbFileAttr == INVALID_FILE_ATTRIBUTES)
                throw Database_OpenFailed("Unable to get file attributes of Sqlite Database.");

            if(dbFileAttr & FILE_ATTRIBUTE_READONLY)
            {
                Console::Wrn("The database is readonly. Clearing this flag automatically.");
                dbFileAttr &= ~FILE_ATTRIBUTE_READONLY;
                if(!SetFileAttributes(host.c_str(), dbFileAttr))
                {
                    throw Database_OpenFailed("Unable to clear read-only flag from database.");
                }
            }
}
#endif // WIN32