Re: g_file_test()



Martin Baulig <martin home-of-linux org> writes:

> Owen Taylor <otaylor redhat com> writes:
> 
> > (I'd think the reason why it's any-of is what you get when you
> > read:
> > 
> >  g_file_test (G_FILE_TEST_IS_REGULAR | G_FILE_TEST_IS_SYMLINK);
> > 
> > Yep, "test file is regular or file is symlink".)
> >   
> > Possibilities for an all-of name include:
> > 
> >  g_file_test_is_all ()
> >  g_file_test_all ()
> >  g_file_is_all ()
> >  g_file_is ()
> 
> What about:
> 
> g_file_test (G_FILE_TEST_IS_REGULAR) && g_file_test (G_FILE_TEST_IS_SYMBOL)

Well, Tim's objection here is that this does two stats, not one,
but I don't think this is awful (This particular test isn't
very useful, of corse, I'd just write FALSE)

Wanting to check for multiple conditions is really pretty darn rare,
and stats aren't that expensive.

The operation that one might conceivably want is:

 g_file_get_test_flags ("foo") 

returning G_FILE_TEST_IS_READABLE | G_FILE_IS_EXECUTABLE.. or something
like that, but that could easily be punted for the future. 

Regards,
                                        Owne




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]