[Psi-devel] Re: History deletion bugfix

Rafael Roquetto rafaelroquetto at gmail.com
Tue Jun 21 12:32:50 PDT 2005


Ok, I have got it.

When Psi try to delete history file, it fails because the file is
already open by the logger (I guess). The solution I found was simply
opening the file with WriteOnly flag and writing a NULL character to
it, hence the file is empty and it works.

Im just going to make some arrangements and send you the patch. 

Regards,
Rafael

On 6/21/05, Rafael Roquetto <rafaelroquetto at gmail.com> wrote:
> It works well good on Linux... But I have just found out it is not
> working under Windows...  and I have already figured out why.
> Well, first, it wasnt working because, even though it erased the
> .history file, it wasnt flushing it from memory. What I did was
> clearing a QPtrList containing the events, thus flushing it from
> memory.
> This is working on Windows, it flushes the memory as it should do.
> Nevertheless, it is not erasing the .history file on  windows (ive
> just found that now). Thats another bug. Maybe thats just happening to
> me, but I doubt, since I have already deleted my PsiData folder and it
> has been recreated by Psi.
> The point is that QDir::remove() returns false when it should return
> true, meaning it was unable to delete the .history file.
> If I try to delete the file by hand, while psi is running, the Windows
> does not allow me, giving me an error message box which says the file
> is being used by another application and I cant be deleted (Psi) in
> this case.
> 
> And I have no idea why it happens. Maybe the file is not being closed
> after being opened and read. Im gonna try to use some native Win32 API
> calls only to check if im able to delete this file, as the
> QDir::remove() doesnt provide me enough feedback nor a clue, it just
> returns false. Then if the Win32 API fails to delete it, I can at
> least get the error (maybe shared access, I dont know)... Suggestions
> are welcome.
> 
> Cheers,
> Rafael
> 
> On 6/21/05, Remko Troncon <remko at psi-im.org> wrote:
> > > By the way, I have just found out this bugfix doesnt work on Windows,
> > > only on Linux....
> >
> > What do you mean by 'not working' ?
> >
> > cheers,
> > Remko
> > _______________________________________________
> > Psi-devel-affinix.com mailing list
> > Psi-devel-affinix.com at lists.affinix.com
> > http://lists.affinix.com/listinfo.cgi/psi-devel-affinix.com
> >
>


More information about the Psi-devel-affinix.com mailing list