Search
lxdream.org :: lxdream/src/lxpaths.h
lxdream 0.9.1
released Jun 29
Download Now
filename src/lxpaths.h
changeset 1205:a486ac64f34b
prev1041:5fcc39857c5c
next1241:74f8e11ab4b8
author nkeynes
date Thu Feb 23 20:16:37 2012 +1000 (12 years ago)
permissions -rw-r--r--
last change Merge emu sign-extension fix to top
file annotate diff log raw
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@1205
    22
#include <glib/gtypes.h>
nkeynes@1205
    23
nkeynes@1041
    24
/****************** System paths ****************/
nkeynes@1041
    25
/**
nkeynes@1041
    26
 * Location of the shared lxdreamrc (e.g. /usr/local/etc/lxdreamrc)
nkeynes@1041
    27
 */
nkeynes@1041
    28
const char *get_sysconf_path();
nkeynes@1041
    29
nkeynes@1041
    30
/**
nkeynes@1041
    31
 * Location of the message catalogs (e.g. /usr/local/share/locale)
nkeynes@1041
    32
 */
nkeynes@1041
    33
const char *get_locale_path();
nkeynes@1041
    34
nkeynes@1041
    35
/**
nkeynes@1041
    36
 * Location of the plugins, if any (e.g. /usr/local/lib/lxdream)
nkeynes@1041
    37
 */
nkeynes@1041
    38
const char *get_plugin_path();
nkeynes@1041
    39
nkeynes@1041
    40
/**
nkeynes@1041
    41
 * Location of the current user's data path (e.g. ~/.lxdream)
nkeynes@1041
    42
 */
nkeynes@1041
    43
const char *get_user_data_path();
nkeynes@1041
    44
nkeynes@1041
    45
/******************** Path helpers *****************/
nkeynes@1041
    46
nkeynes@1041
    47
/**
nkeynes@1041
    48
 * Escape a pathname if needed to prevent shell substitution.
nkeynes@1041
    49
 * @return a newly allocated string (or NULL if the input is NULL)
nkeynes@1041
    50
 */
nkeynes@1041
    51
gchar *get_escaped_path( const gchar *name );
nkeynes@1041
    52
nkeynes@1041
    53
/**
nkeynes@1041
    54
 * Expand a pathname according to standard shell substitution rules
nkeynes@1041
    55
 * (excluding command substitutions).
nkeynes@1041
    56
 * @return a newly allocated string (or NULL if the input is NULL)
nkeynes@1041
    57
 */
nkeynes@1041
    58
gchar *get_expanded_path( const gchar *name );
nkeynes@1041
    59
nkeynes@1041
    60
/**
nkeynes@1041
    61
 * Return an absolute path for the given input path, as a newly allocated
nkeynes@1041
    62
 * string. If the input path is already absolute, the returned string will
nkeynes@1041
    63
 * be identical to the input string.
nkeynes@1041
    64
 */
nkeynes@1041
    65
gchar *get_absolute_path( const gchar *path );
nkeynes@1041
    66
nkeynes@1041
    67
/**
nkeynes@1041
    68
 * Construct a filename in the same directory as the file at. That is,
nkeynes@1041
    69
 * if at is "/tmp/foo" and filename = "bar", the function returns 
nkeynes@1041
    70
 * "/tmp/bar".
nkeynes@1041
    71
 * @return a newly allocated string that must be released by the caller.
nkeynes@1041
    72
 */
nkeynes@1041
    73
gchar *get_filename_at( const gchar *at, const gchar *filename );
nkeynes@1041
    74
nkeynes@1041
    75
nkeynes@1041
    76
/********************* GUI Paths ***********************/
nkeynes@1041
    77
/* The following functions provide a cache for the most recently accessed
nkeynes@1041
    78
 * path for each config key (ie for GUI file open/save dialogs)
nkeynes@1041
    79
 */
nkeynes@1041
    80
/**
nkeynes@1041
    81
 * Get the path corresponding to the given global config key
nkeynes@1041
    82
 */
nkeynes@1041
    83
const gchar *get_gui_path(int key);
nkeynes@1041
    84
nkeynes@1041
    85
/**
nkeynes@1041
    86
 * Override the path for the given global config key, without changing the
nkeynes@1041
    87
 * underlying configuration.
nkeynes@1041
    88
 */
nkeynes@1041
    89
void set_gui_path( int key, const gchar *path );
nkeynes@1041
    90
nkeynes@1041
    91
/**
nkeynes@1041
    92
 * Notify the helper functions that the config paths have changed, in which
nkeynes@1041
    93
 * event they will revert to the config-specified versions.
nkeynes@1041
    94
 */
nkeynes@1041
    95
void reset_gui_paths();
nkeynes@1041
    96
nkeynes@1041
    97
nkeynes@1041
    98
nkeynes@1041
    99
#endif /* !lxdream_paths_H */
.