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 #include <glib/gtypes.h>
24 /****************** System paths ****************/
26 * Location of the shared lxdreamrc (e.g. /usr/local/etc/lxdreamrc)
28 const char *get_sysconf_path();
31 * Location of the message catalogs (e.g. /usr/local/share/locale)
33 const char *get_locale_path();
36 * Location of the plugins, if any (e.g. /usr/local/lib/lxdream)
38 const char *get_plugin_path();
41 * Location of the current user's data path (e.g. ~/.lxdream)
43 const char *get_user_data_path();
45 /******************** Path helpers *****************/
48 * Escape a pathname if needed to prevent shell substitution.
49 * @return a newly allocated string (or NULL if the input is NULL)
51 gchar *get_escaped_path( const gchar *name );
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)
58 gchar *get_expanded_path( const gchar *name );
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.
65 gchar *get_absolute_path( const gchar *path );
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
71 * @return a newly allocated string that must be released by the caller.
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)
81 * Get the path corresponding to the given global config key
83 const gchar *get_gui_path(int key);
86 * Override the path for the given global config key, without changing the
87 * underlying configuration.
89 void set_gui_path( int key, const gchar *path );
92 * Notify the helper functions that the config paths have changed, in which
93 * event they will revert to the config-specified versions.
95 void reset_gui_paths();
99 #endif /* !lxdream_paths_H */
.