Search
lxdream.org :: lxdream/src/lxpaths.h
lxdream 0.9.1
released Jun 29
Download Now
filename src/lxpaths.h
changeset 1205:a486ac64f34b
prev1041:5fcc39857c5c
next1241:74f8e11ab4b8
author nkeynes
date Mon Jan 30 20:11:08 2012 +1000 (10 years ago)
permissions -rw-r--r--
last change Replace wordexp() with a hand-coded env-var substitution. More portable, and
avoids bugs with some wordexp() implementations
view annotate diff log raw
     1 /**
     2  * $Id$
     3  *
     4  * Various path definitions and helper functions
     5  *
     6  * Copyright (c) 2005 Nathan Keynes.
     7  *
     8  * This program is free software; you can redistribute it and/or modify
     9  * it under the terms of the GNU General Public License as published by
    10  * the Free Software Foundation; either version 2 of the License, or
    11  * (at your option) any later version.
    12  *
    13  * This program is distributed in the hope that it will be useful,
    14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
    15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    16  * GNU General Public License for more details.
    17  */
    19 #ifndef lxdream_paths_H
    20 #define lxdream_paths_H
    22 #include <glib/gtypes.h>
    24 /****************** System paths ****************/
    25 /**
    26  * Location of the shared lxdreamrc (e.g. /usr/local/etc/lxdreamrc)
    27  */
    28 const char *get_sysconf_path();
    30 /**
    31  * Location of the message catalogs (e.g. /usr/local/share/locale)
    32  */
    33 const char *get_locale_path();
    35 /**
    36  * Location of the plugins, if any (e.g. /usr/local/lib/lxdream)
    37  */
    38 const char *get_plugin_path();
    40 /**
    41  * Location of the current user's data path (e.g. ~/.lxdream)
    42  */
    43 const char *get_user_data_path();
    45 /******************** Path helpers *****************/
    47 /**
    48  * Escape a pathname if needed to prevent shell substitution.
    49  * @return a newly allocated string (or NULL if the input is NULL)
    50  */
    51 gchar *get_escaped_path( const gchar *name );
    53 /**
    54  * Expand a pathname according to standard shell substitution rules
    55  * (excluding command substitutions).
    56  * @return a newly allocated string (or NULL if the input is NULL)
    57  */
    58 gchar *get_expanded_path( const gchar *name );
    60 /**
    61  * Return an absolute path for the given input path, as a newly allocated
    62  * string. If the input path is already absolute, the returned string will
    63  * be identical to the input string.
    64  */
    65 gchar *get_absolute_path( const gchar *path );
    67 /**
    68  * Construct a filename in the same directory as the file at. That is,
    69  * if at is "/tmp/foo" and filename = "bar", the function returns 
    70  * "/tmp/bar".
    71  * @return a newly allocated string that must be released by the caller.
    72  */
    73 gchar *get_filename_at( const gchar *at, const gchar *filename );
    76 /********************* GUI Paths ***********************/
    77 /* The following functions provide a cache for the most recently accessed
    78  * path for each config key (ie for GUI file open/save dialogs)
    79  */
    80 /**
    81  * Get the path corresponding to the given global config key
    82  */
    83 const gchar *get_gui_path(int key);
    85 /**
    86  * Override the path for the given global config key, without changing the
    87  * underlying configuration.
    88  */
    89 void set_gui_path( int key, const gchar *path );
    91 /**
    92  * Notify the helper functions that the config paths have changed, in which
    93  * event they will revert to the config-specified versions.
    94  */
    95 void reset_gui_paths();
    99 #endif /* !lxdream_paths_H */
.