filename | src/lxpaths.h |
changeset | 1041:5fcc39857c5c |
next | 1205:a486ac64f34b |
author | nkeynes |
date | Sun Jun 28 12:07:21 2009 +0000 (14 years ago) |
permissions | -rw-r--r-- |
last change | Fix handling of rename failure Fix boneheadedness in get_filename_at |
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 /****************** System paths ****************/
23 /**
24 * Location of the shared lxdreamrc (e.g. /usr/local/etc/lxdreamrc)
25 */
26 const char *get_sysconf_path();
28 /**
29 * Location of the message catalogs (e.g. /usr/local/share/locale)
30 */
31 const char *get_locale_path();
33 /**
34 * Location of the plugins, if any (e.g. /usr/local/lib/lxdream)
35 */
36 const char *get_plugin_path();
38 /**
39 * Location of the current user's data path (e.g. ~/.lxdream)
40 */
41 const char *get_user_data_path();
43 /******************** Path helpers *****************/
45 /**
46 * Escape a pathname if needed to prevent shell substitution.
47 * @return a newly allocated string (or NULL if the input is NULL)
48 */
49 gchar *get_escaped_path( const gchar *name );
51 /**
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)
55 */
56 gchar *get_expanded_path( const gchar *name );
58 /**
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.
62 */
63 gchar *get_absolute_path( const gchar *path );
65 /**
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
68 * "/tmp/bar".
69 * @return a newly allocated string that must be released by the caller.
70 */
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)
77 */
78 /**
79 * Get the path corresponding to the given global config key
80 */
81 const gchar *get_gui_path(int key);
83 /**
84 * Override the path for the given global config key, without changing the
85 * underlying configuration.
86 */
87 void set_gui_path( int key, const gchar *path );
89 /**
90 * Notify the helper functions that the config paths have changed, in which
91 * event they will revert to the config-specified versions.
92 */
93 void reset_gui_paths();
97 #endif /* !lxdream_paths_H */
.