nkeynes@1041 | 1 | /**
|
nkeynes@1041 | 2 | * $Id$
|
nkeynes@1041 | 3 | *
|
nkeynes@1041 | 4 | * Various path definitions and helper functions
|
nkeynes@1041 | 5 | *
|
nkeynes@1041 | 6 | * Copyright (c) 2005 Nathan Keynes.
|
nkeynes@1041 | 7 | *
|
nkeynes@1041 | 8 | * This program is free software; you can redistribute it and/or modify
|
nkeynes@1041 | 9 | * it under the terms of the GNU General Public License as published by
|
nkeynes@1041 | 10 | * the Free Software Foundation; either version 2 of the License, or
|
nkeynes@1041 | 11 | * (at your option) any later version.
|
nkeynes@1041 | 12 | *
|
nkeynes@1041 | 13 | * This program is distributed in the hope that it will be useful,
|
nkeynes@1041 | 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
nkeynes@1041 | 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
nkeynes@1041 | 16 | * GNU General Public License for more details.
|
nkeynes@1041 | 17 | */
|
nkeynes@1041 | 18 |
|
nkeynes@1041 | 19 | #ifndef lxdream_paths_H
|
nkeynes@1041 | 20 | #define lxdream_paths_H
|
nkeynes@1041 | 21 |
|
nkeynes@1041 | 22 | /****************** System paths ****************/
|
nkeynes@1041 | 23 | /**
|
nkeynes@1041 | 24 | * Location of the shared lxdreamrc (e.g. /usr/local/etc/lxdreamrc)
|
nkeynes@1041 | 25 | */
|
nkeynes@1041 | 26 | const char *get_sysconf_path();
|
nkeynes@1041 | 27 |
|
nkeynes@1041 | 28 | /**
|
nkeynes@1041 | 29 | * Location of the message catalogs (e.g. /usr/local/share/locale)
|
nkeynes@1041 | 30 | */
|
nkeynes@1041 | 31 | const char *get_locale_path();
|
nkeynes@1041 | 32 |
|
nkeynes@1041 | 33 | /**
|
nkeynes@1041 | 34 | * Location of the plugins, if any (e.g. /usr/local/lib/lxdream)
|
nkeynes@1041 | 35 | */
|
nkeynes@1041 | 36 | const char *get_plugin_path();
|
nkeynes@1041 | 37 |
|
nkeynes@1041 | 38 | /**
|
nkeynes@1041 | 39 | * Location of the current user's data path (e.g. ~/.lxdream)
|
nkeynes@1041 | 40 | */
|
nkeynes@1041 | 41 | const char *get_user_data_path();
|
nkeynes@1041 | 42 |
|
nkeynes@1041 | 43 | /******************** Path helpers *****************/
|
nkeynes@1041 | 44 |
|
nkeynes@1041 | 45 | /**
|
nkeynes@1041 | 46 | * Escape a pathname if needed to prevent shell substitution.
|
nkeynes@1041 | 47 | * @return a newly allocated string (or NULL if the input is NULL)
|
nkeynes@1041 | 48 | */
|
nkeynes@1041 | 49 | gchar *get_escaped_path( const gchar *name );
|
nkeynes@1041 | 50 |
|
nkeynes@1041 | 51 | /**
|
nkeynes@1041 | 52 | * Expand a pathname according to standard shell substitution rules
|
nkeynes@1041 | 53 | * (excluding command substitutions).
|
nkeynes@1041 | 54 | * @return a newly allocated string (or NULL if the input is NULL)
|
nkeynes@1041 | 55 | */
|
nkeynes@1041 | 56 | gchar *get_expanded_path( const gchar *name );
|
nkeynes@1041 | 57 |
|
nkeynes@1041 | 58 | /**
|
nkeynes@1041 | 59 | * Return an absolute path for the given input path, as a newly allocated
|
nkeynes@1041 | 60 | * string. If the input path is already absolute, the returned string will
|
nkeynes@1041 | 61 | * be identical to the input string.
|
nkeynes@1041 | 62 | */
|
nkeynes@1041 | 63 | gchar *get_absolute_path( const gchar *path );
|
nkeynes@1041 | 64 |
|
nkeynes@1041 | 65 | /**
|
nkeynes@1041 | 66 | * Construct a filename in the same directory as the file at. That is,
|
nkeynes@1041 | 67 | * if at is "/tmp/foo" and filename = "bar", the function returns
|
nkeynes@1041 | 68 | * "/tmp/bar".
|
nkeynes@1041 | 69 | * @return a newly allocated string that must be released by the caller.
|
nkeynes@1041 | 70 | */
|
nkeynes@1041 | 71 | gchar *get_filename_at( const gchar *at, const gchar *filename );
|
nkeynes@1041 | 72 |
|
nkeynes@1041 | 73 |
|
nkeynes@1041 | 74 | /********************* GUI Paths ***********************/
|
nkeynes@1041 | 75 | /* The following functions provide a cache for the most recently accessed
|
nkeynes@1041 | 76 | * path for each config key (ie for GUI file open/save dialogs)
|
nkeynes@1041 | 77 | */
|
nkeynes@1041 | 78 | /**
|
nkeynes@1041 | 79 | * Get the path corresponding to the given global config key
|
nkeynes@1041 | 80 | */
|
nkeynes@1041 | 81 | const gchar *get_gui_path(int key);
|
nkeynes@1041 | 82 |
|
nkeynes@1041 | 83 | /**
|
nkeynes@1041 | 84 | * Override the path for the given global config key, without changing the
|
nkeynes@1041 | 85 | * underlying configuration.
|
nkeynes@1041 | 86 | */
|
nkeynes@1041 | 87 | void set_gui_path( int key, const gchar *path );
|
nkeynes@1041 | 88 |
|
nkeynes@1041 | 89 | /**
|
nkeynes@1041 | 90 | * Notify the helper functions that the config paths have changed, in which
|
nkeynes@1041 | 91 | * event they will revert to the config-specified versions.
|
nkeynes@1041 | 92 | */
|
nkeynes@1041 | 93 | void reset_gui_paths();
|
nkeynes@1041 | 94 |
|
nkeynes@1041 | 95 |
|
nkeynes@1041 | 96 |
|
nkeynes@1041 | 97 | #endif /* !lxdream_paths_H */
|