Gnome Library Reference Manual
<<< Previous Page | Home | Up | Next Page >>>

# gnome-util

## Name

gnome-util -- Miscellaneous utility functions for GNOME and C programs.

## Synopsis

    #include <gnome.h>

    #define     PATH_SEP
    #define     PATH_SEP_STR
    char*       gnome_libdir_file               (const char *filename);
    char*       gnome_datadir_file              (const char *filename);
    char*       gnome_sound_file                (const char *filename);
    char*       gnome_pixmap_file               (const char *filename);
    char*       gnome_config_file               (const char *filename);
    char*       gnome_unconditional_libdir_file (const char *filename);
    char*       gnome_unconditional_datadir_file
                                                (const char *filename);
    char*       gnome_unconditional_sound_file  (const char *filename);
    char*       gnome_unconditional_pixmap_file (const char *filename);
    char*       gnome_unconditional_config_file (const char *filename);
    int         g_file_test                     (const char *filename,
                                                 int test);
    int         g_file_exists                   (const char *filename);
    #define     g_copy_strings
    const char* g_unix_error_string             (int error_num);
    char*       g_concat_dir_and_file           (const char *dir,
                                                 const char *file);
    #define     g_filename_index                (path)
    #define     g_filename_pointer
    const char* g_extension_pointer             (const char *path);
    char**      g_copy_vector                   (char **vec);
    #define     g_flatten_vector
    #define     gnome_util_user_home            ()
    #define     gnome_util_prepend_user_home    (x)
    #define     gnome_util_home_file            (afile)
    char*       gnome_util_user_shell           (void);
    gboolean    g_is_image_filename             (const char *path);

## Description

## Details

### PATH_SEP

    #define PATH_SEP '/'

A int macro that represents the character used as the path separator in this operating system

### PATH_SEP_STR

    #define PATH_SEP_STR "/"

A char * string that represents the character used as the path separator in this operating system. This comes in string fashion.

### gnome_libdir_file ()

    char*       gnome_libdir_file               (const char *filename);

Locates a shared file either in the GNOMEDIR tree, the GNOME installation directory or in the current directory

`filename` : | filename to locate in libdir
Returns : | a newly allocated pathname pointing to a file in the gnome libdir or NULL if the file does not exist.

### gnome_datadir_file ()

    char*       gnome_datadir_file              (const char *filename);

Locates a shared file either in the GNOMEDIR tree, the GNOME installation directory or in the current directory

`filename` : | shared filename to locate
Returns : | a newly allocated pathname pointing to a file in the gnome sharedir or NULL if the file does not exist.

### gnome_sound_file ()

    char*       gnome_sound_file                (const char *filename);

Locates a sound file either in the GNOMEDIR tree, the GNOME installation directory or in the current directory

`filename` : | sound filename to locate.
Returns : | a newly allocated pathname pointing to a file in the gnome sound directory or NULL if the file does not exist.

### gnome_pixmap_file ()

    char*       gnome_pixmap_file               (const char *filename);

`filename` : | pixmap filename
Returns : | a newly allocated filename from the GNOMEDIR tree or from the GNOME installation directory for the pixmap directory ($prefix/share/pixmaps), or NULL if the file does not exist.

### gnome_config_file ()

    char*       gnome_config_file               (const char *filename);

Locates a configuration file ($prefix/etc) in the GNOMEDIR tree, the GNOME installation direcory or the current directory.

`filename` : | config filename
Returns : | a newly allocated filename from the GNOMEDIR tree or from the GNOME installation directory

### gnome_unconditional_libdir_file ()

    char*       gnome_unconditional_libdir_file (const char *filename);

`filename` : | library filename
Returns : | a newly allocated pathname pointing to a (possibly non-existent) file from the GNOMEDIR tree or from the GNOME installation directory

### gnome_unconditional_datadir_file ()

    char*       gnome_unconditional_datadir_file
                                                (const char *filename);

`filename` : | datadir filename
Returns : | a newly allocated pathname pointing to a (possibly non-existent) file from the GNOMEDIR tree or from the GNOME installation directory

### gnome_unconditional_sound_file ()

    char*       gnome_unconditional_sound_file  (const char *filename);

`filename` : | sound filename
Returns : | a newly allocated filename from the GNOMEDIR tree or from the GNOME installation directory

### gnome_unconditional_pixmap_file ()

    char*       gnome_unconditional_pixmap_file (const char *filename);

`filename` : | pixmap filename
Returns : | a newly allocated filename from the GNOMEDIR tree or from the GNOME installation directory for the pixmap directory ($prefix/share/pixmaps)

### gnome_unconditional_config_file ()

    char*       gnome_unconditional_config_file (const char *filename);

`filename` : | configuration filename
Returns : | a newly allocated filename pointing to a (possibly non-existent) file from the GNOMEDIR tree or from the GNOME installation directory for the configuration directory ($prefix/etc).

### g_file_test ()

    int         g_file_test                     (const char *filename,
                                                 int test);

test is one of: G_FILE_TEST_ISFILE, to check if the pathname is a file G_FILE_TEST_ISLINK, to check if the pathname is a symlink G_FILE_TEST_ISDIR, to check if the pathname is a directory

`filename` : | filename to test
`test` : | test to perform on the file
Returns : | true if filename passes the specified test (an or expression of tests)

### g_file_exists ()

    int         g_file_exists                   (const char *filename);

`filename` : | pathname to test for existance.
Returns : | true if filename exists left in for binary compatibility for a while FIXME: remove

### g_copy_strings

    #define     g_copy_strings

Deprecated. Use `g_strconcat()`.

### g_unix_error_string ()

    const char* g_unix_error_string             (int error_num);

`error_num` : | The errno number.
Returns : | a pointer to a static buffer containing the description of the error reported by the errno.

### g_concat_dir_and_file ()

    char*       g_concat_dir_and_file           (const char *dir,
                                                 const char *file);

`dir` : | directory name
`file` : | filename.
Returns : | a new allocated string that is the concatenation of dir and file, takes care of the exact details for concatenating them.

### g_filename_index()

    #define     g_filename_index(path)

### g_filename_pointer

    #define     g_filename_pointer

### g_extension_pointer ()

    const char* g_extension_pointer             (const char *path);

### g_copy_vector ()

    char**      g_copy_vector                   (char **vec);

### g_flatten_vector

    #define     g_flatten_vector

Deprecated. Use `g_strjoinv()`.

### gnome_util_user_home()

    #define     gnome_util_user_home()

Deprecated. Use `g_get_home_dir()`.

### gnome_util_prepend_user_home()

    #define     gnome_util_prepend_user_home(x)

Deprecated. Use `g_get_home_dir()` and `g_concat_dir_and_file()`.

### gnome_util_home_file()

    #define     gnome_util_home_file(afile)

Deprecated.

`afile` : |

### gnome_util_user_shell ()

    char*       gnome_util_user_shell           (void);

Get the user's shell.

Returns : | a newly allocated string that is the path to the user's preferred shell.

### g_is_image_filename ()

    gboolean    g_is_image_filename             (const char *path);

Deprecated. Extra lame way of figuring if a filename is an image file. You should use the gnome_mime functions instead and match against "image/".

Deprecated. Use gnome-mime stuff instead.

<<< Previous Page | Home | Up | Next Page >>>
gnome-url | libgnome