Re: glib outstanding stuff



On 5 Oct 2000, Havoc Pennington wrote:

> 
> Hi,
> 
> I rewrote g_file_get_contents, appended. Thanks for the comments so
> far.
> 
> Havoc

> 
> typedef enum
> {
>   G_FILE_TEST_IS_DIR        = 1 << 1,
>   G_FILE_TEST_EXISTS        = 1 << 2,
>   G_FILE_TEST_IS_EXECUTABLE = 1 << 3,
>   G_FILE_TEST_IS_SYMLINK    = 1 << 4
> } GFileTest;

> gboolean g_file_test         (const gchar  *filename,
>                               GFileTest     test);

> /**
>  * g_file_test:
>  * @filename: a filename to test
>  * @test: bitfield of #GFileTest flags
>  * 
>  * Returns TRUE if any of the tests in the bitfield @test are
>  * TRUE. For example, (G_FILE_TEST_EXISTS | G_FILE_TEST_IS_DIR)
>  * will return TRUE if the file exists; the check whether it's
>  * a directory doesn't matter since the existence test is TRUE.
>  * With the current set of available tests, there's no point
>  * passing in more than one test at a time.
>  *
>  * Return value: whether a test was TRUE
>  **/

i don't have a strong opinion on whether we should have a function
for the "any" or "all" tests, but i find the name g_file_test()
annoyingly unintuitive to perform an "any" test.
judging from the name, "g_file_test" should do an "all" test,
if you want it match any GFileTest bit, call it "g_file_test_any".

oh, and please do me a favour, when you commit this patch, please
also remove g_scanner_stat_mode() entirely on the way.

---
ciaoTJ





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