4 * Various path definitions and helper functions
6 * Copyright (c) 2005 Nathan Keynes.
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.
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.
19 #ifndef lxdream_paths_H
20 #define lxdream_paths_H
22 /****************** System paths ****************/
24 * Location of the shared lxdreamrc (e.g. /usr/local/etc/lxdreamrc)
26 const char *get_sysconf_path();
29 * Location of the message catalogs (e.g. /usr/local/share/locale)
31 const char *get_locale_path();
34 * Location of the plugins, if any (e.g. /usr/local/lib/lxdream)
36 const char *get_plugin_path();
39 * Location of the current user's data path (e.g. ~/.lxdream)
41 const char *get_user_data_path();
43 /******************** Path helpers *****************/
46 * Escape a pathname if needed to prevent shell substitution.
47 * @return a newly allocated string (or NULL if the input is NULL)
49 gchar *get_escaped_path( const gchar *name );
52 * Expand a pathname according to standard shell substitution rules
53 * (excluding command substitutions).
54 * @return a newly allocated string (or NULL if the input is NULL)
56 gchar *get_expanded_path( const gchar *name );
59 * Return an absolute path for the given input path, as a newly allocated
60 * string. If the input path is already absolute, the returned string will
61 * be identical to the input string.
63 gchar *get_absolute_path( const gchar *path );
66 * Construct a filename in the same directory as the file at. That is,
67 * if at is "/tmp/foo" and filename = "bar", the function returns
69 * @return a newly allocated string that must be released by the caller.
71 gchar *get_filename_at( const gchar *at, const gchar *filename );
74 /********************* GUI Paths ***********************/
75 /* The following functions provide a cache for the most recently accessed
76 * path for each config key (ie for GUI file open/save dialogs)
79 * Get the path corresponding to the given global config key
81 const gchar *get_gui_path(int key);
84 * Override the path for the given global config key, without changing the
85 * underlying configuration.
87 void set_gui_path( int key, const gchar *path );
90 * Notify the helper functions that the config paths have changed, in which
91 * event they will revert to the config-specified versions.
93 void reset_gui_paths();
97 #endif /* !lxdream_paths_H */
.