Re: Utility functions from gnome-libs
- From: Tim Janik <timj gtk org>
- To: Owen Taylor <otaylor redhat com>
- Cc: gtk-devel-list gnome org
- Subject: Re: Utility functions from gnome-libs
- Date: Tue, 4 Jul 2000 06:52:28 +0200 (CEST)
On 3 Jul 2000, Owen Taylor wrote:
>
> gnome-libs has a number of "should be in GLib" functions that
> it would be nice to to really move in GLib for GLib-2.0.
>
> The main interesting functions are the following functions
> from gnome-utils.h:
>
> enum {
> G_FILE_TEST_ISFILE=1<<0,
> G_FILE_TEST_ISLINK=1<<1,
> G_FILE_TEST_ISDIR=1<<2,
> G_FILE_TEST_EXISTS=(1<<0)|(1<<1)|(1<<2) /*any type of file*/
> };
>
> gboolean g_file_test (const char *filename, int test);
> gboolean g_file_exists (const char *filename);
>
> (These might alternatively be called g_file_race() ;-), but
> they are useful for a lot of things, and a note in the
> docs about security implications should be OK.)
no, that's not a good idea. instead, it'll probably not hurt to
simply implement g_file_test() in terms of:
typedef enum
{
G_FILE_IS_FILE = 1 << 0,
G_FILE_IS_LINK = 1 << 1,
G_FILE_IS_DIR = 1 << 2,
G_FILE_EXISTS = G_FILE_IS_FILE | G_FILE_IS_LINK | G_FILE_IS_DIR
} GFileType;
GFileType g_file_test (const char *filename);
> /* locate a program in $PATH, or return NULL if not found */
> char *gnome_is_program_in_path (const gchar *program);
>
> This would be renamed to g_is_program_in_path()
rather i'd call it g_find_program_in_path() since it
1) doesn't return a gboolean but a string
2) it can take quite some time to do all the path searching
> Regards,
> Owen
>
---
ciaoTJ
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]