Utility functions from gnome-libs



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.)
  
/* 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()

/* Make a dir and a file into a full path, handling / issues. */
char *g_concat_dir_and_file (const char *dir, const char *file);

/* Return pointer to the character after the last .,
   or "" if no dot. */
const char * g_extension_pointer (const char * path);

/* vec has to be NULL-terminated */
char ** g_copy_vector    (const char ** vec);

This probably should be g_strcopyv() to go along with g_strfreev().

Outside of the gnome-utils, the main candidate for inclusion
in GLib might be the stuff in gnome-exec.h. Doing a proper
fork/exec to execute something in the background is rather
complicated, so having g_exec_async() might be a big help
for people.

Regards,
                                        Owen




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