[EMAIL PROTECTED] wrote:
   > while working on the FS module unit test design I had some thoughts
   > about pdf_fsys_item_readable_p() and pdf_fsys_item_writeable_p().
   > Atm they return PDF_TRUE or PDF_FALSE depending on wether the given file
   > is readable/writeable or not. But shouldn't both functions handle
   > non-existing files, Or will they just return PDF_FALSE?
> I agree with you. Returning a pdf_status_t with an error code could be
   better. Like PDF_OK if successful, PDF_ERROR if not, and PDF_EEXIST if
   file doesn't exist.

Agreed.
I also agree.


   And BTW, we should probably have an additional function for multiple
   checks, like a wrapper for the access() function.

   Then the pdf_fsys_item_p, pdf_fsys_item_is_readable_p and
   pdf_fsys_item_is_writable_p functions could even be macros calling
   pdf_fsys_item_access.

That modification would involve to change the filesystem
implementation interface. Not all filesystems will have an access-like
functionality in a native way.

As a matter of convenience we could provide a pdf_fsys_item_access function
that would internally use the pdf_fsys_item_* functions.

We basically have this already with pdf_fsys_get_item_props. My intention is to just have pdf_fsys_item_{writable/readable}_p call that function in the disk implementation.

For pdf_fsys_get_item_p I went the route of just trying to open the file. Though I could just make it call pdf_fsys_get_item_props as well.

-Zac



Reply via email to