The problem I had with documents being "out-of-sync" with their
categories was a local problem only present in my own copy.

However, it didn't take that long to find the problem with the
default category not being assigned for documents on external media.

I don't know what I was smoking when I wrote that part of the code;
it was quite broken, though ;-) The location of the document was
assigned *after* the function that gets the default category was
called and the volume reference was never assigned. Well, to be able
to get the default category we must open the document and that
requires both the location and volume reference...

It's times like this I wish the code would have been written in a
more Extreme Programming kind of way from the very beginning; it
would not be a funny task to write test cases for all the code now,
though.

I have fixed the problem in the unstable branch and included it
in my very large patch (almost 1.1M at the moment and I will add a
few more changes the next few days); if I can find some volunteer
among the other Plucker developers it should appear in CVS later
on, too ;-)

Anyway, if you can build your own binary then open vfsfile.c and
search for GetDefaultCategories.

Move 

    docInfo.location    = location;
    docInfo.active      = true;

to before the ErrTry block and add the following line (also before
the ErrTry block),

    docInfo.volumeRef   = volRefNum;

It should look something like this after you have made the changes,

    else {
        docInfo.active      = true;
        docInfo.location    = location;
        docInfo.volumeRef   = volRefNum;
        ErrTry { 
            docInfo.categories = GetDefaultCategories( &docInfo );
        }
        ErrCatch( UNUSED_PARAM( err ) ) {
            docInfo.categories = UNFILED_CATEGORY;
        } ErrEndCatch 
        AddDocument( &docInfo, volumeLabel );
    }   


In the 1.2 code base the assignment of the location is before the
GetDefaultCategories call, but the volume reference is not assigned,
so if you are using that code you only have to add the
"docInfo.volumeRef = volRefNum;" line.

That should fix the problem.

/Mike
_______________________________________________
plucker-dev mailing list
[EMAIL PROTECTED]
http://lists.rubberchicken.org/mailman/listinfo/plucker-dev

Reply via email to