filename | src/lxpaths.h |
changeset | 1241:74f8e11ab4b8 |
prev | 1205:a486ac64f34b |
next | 1296:30ecee61f811 |
author | nkeynes |
date | Tue Feb 28 17:27:39 2012 +1000 (11 years ago) |
permissions | -rw-r--r-- |
last change | Pass the application home dir through to the native code, so we can use it as the default data directory |
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 /**
46 * Set the user data path
47 */
48 void set_user_data_path( const char *p );
50 /******************** Path helpers *****************/
52 /**
53 * Escape a pathname if needed to prevent shell substitution.
54 * @return a newly allocated string (or NULL if the input is NULL)
55 */
56 gchar *get_escaped_path( const gchar *name );
58 /**
59 * Expand a pathname according to standard shell substitution rules
60 * (excluding command substitutions).
61 * @return a newly allocated string (or NULL if the input is NULL)
62 */
63 gchar *get_expanded_path( const gchar *name );
65 /**
66 * Return an absolute path for the given input path, as a newly allocated
67 * string. If the input path is already absolute, the returned string will
68 * be identical to the input string.
69 */
70 gchar *get_absolute_path( const gchar *path );
72 /**
73 * Construct a filename in the same directory as the file at. That is,
74 * if at is "/tmp/foo" and filename = "bar", the function returns
75 * "/tmp/bar".
76 * @return a newly allocated string that must be released by the caller.
77 */
78 gchar *get_filename_at( const gchar *at, const gchar *filename );
81 /********************* GUI Paths ***********************/
82 /* The following functions provide a cache for the most recently accessed
83 * path for each config key (ie for GUI file open/save dialogs)
84 */
85 /**
86 * Get the path corresponding to the given global config key
87 */
88 const gchar *get_gui_path(int key);
90 /**
91 * Override the path for the given global config key, without changing the
92 * underlying configuration.
93 */
94 void set_gui_path( int key, const gchar *path );
96 /**
97 * Notify the helper functions that the config paths have changed, in which
98 * event they will revert to the config-specified versions.
99 */
100 void reset_gui_paths();
104 #endif /* !lxdream_paths_H */
.