Hi Erel
Man you could be right about that.
The problem could be that the file I am renaming is a database file which I open using sqLite viz:
sqlRecent.InitializeSQLite(path, dbName, False)
I do this at the initialisation of my class as a store for recently used files.
However as far as I know there is no sqLite. Close command. I thought that the file handle was closed when all transactions are completed, but maybe not. It depends how the Java Gurus have implemented the Virtual File System for the sqLite C Code.
Here is a snippet of the VFS I wrote for my embedded system, is is the file close wrapper which interfaces between the sqLite amalgamation and the fatfs system:
/*
**********************************************************************************
** Close a file.
*/
static int vfsClose(sqlite3_file *pFile)
{
int rc;
FRESULT result;
vfsFile *p = (vfsFile*)pFile;
rc = vfsFlushBuffer(p);
sqlite3_free(p->aBuffer);
result = f_close(&p->fd);
#if DEBUG_VFS == 1
SEGGER_RTT_printf(0,RTT_CTRL_TEXT_BRIGHT_GREEN"File Close File Handle = %x Result = %d RC = %x\n", &p->fd, result, rc);
#endif
return rc;
}
It could be that our friends at Oracle or who write the drivers may not have implemented this part of the VFS.
The other issue I have is that renaming the db file alone doesn't do the full thing because the journals will need to be renamed to. If I could get the Pragma checkpoint command to work this wouldn't be an issue.
The renaming problem occurs even when I don't write a transaction to the database after opening the app.
I was using the renaming method to avoid having to copy all of the transactions. The idea is that if the user want's to clear the recent files list, it is done by renaming the original and creating an empty new one. That way if the user accidentally clears the list they can get the old one back.
I will have a poke around and see what I can come up with.
Best regards
Rob