Search
lxdream.org :: lxdream/src/paths_unix.c
lxdream 0.9.1
released Jun 29
Download Now
filename src/paths_unix.c
changeset 1241:74f8e11ab4b8
prev1038:f220d18c0615
next1296:30ecee61f811
author nkeynes
date Tue Feb 28 17:27:39 2012 +1000 (8 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
file annotate diff log raw
nkeynes@964
     1
/**
nkeynes@1021
     2
 * $Id$
nkeynes@964
     3
 *
nkeynes@964
     4
 * Wrappers for system-dependent functions (mainly path differences)
nkeynes@964
     5
 *
nkeynes@964
     6
 * Copyright (c) 2008 Nathan Keynes.
nkeynes@964
     7
 *
nkeynes@964
     8
 * This program is free software; you can redistribute it and/or modify
nkeynes@964
     9
 * it under the terms of the GNU General Public License as published by
nkeynes@964
    10
 * the Free Software Foundation; either version 2 of the License, or
nkeynes@964
    11
 * (at your option) any later version.
nkeynes@964
    12
 *
nkeynes@964
    13
 * This program is distributed in the hope that it will be useful,
nkeynes@964
    14
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
nkeynes@964
    15
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
nkeynes@964
    16
 * GNU General Public License for more details.
nkeynes@964
    17
 */
nkeynes@964
    18
nkeynes@964
    19
#include <string.h>
nkeynes@1038
    20
#include <stdlib.h>
nkeynes@1038
    21
#include <glib/gstrfuncs.h>
nkeynes@964
    22
nkeynes@964
    23
#include "lxdream.h"
nkeynes@1038
    24
#include "config.h"
nkeynes@964
    25
nkeynes@964
    26
const char *get_sysconf_path()
nkeynes@964
    27
{
nkeynes@964
    28
    return PACKAGE_CONF_DIR;
nkeynes@964
    29
}
nkeynes@964
    30
nkeynes@964
    31
const char *get_locale_path()
nkeynes@964
    32
{
nkeynes@964
    33
    return PACKAGE_LOCALE_DIR;
nkeynes@964
    34
}
nkeynes@964
    35
nkeynes@1024
    36
const char *get_plugin_path()
nkeynes@1024
    37
{
nkeynes@1024
    38
    return PACKAGE_PLUGIN_DIR;
nkeynes@1024
    39
}
nkeynes@1038
    40
nkeynes@1038
    41
static char *user_data_path = NULL;
nkeynes@1038
    42
nkeynes@1038
    43
const char *get_user_data_path()
nkeynes@1038
    44
{
nkeynes@1038
    45
    if( user_data_path == NULL ) {
nkeynes@1038
    46
        char *home = getenv("HOME");
nkeynes@1038
    47
        user_data_path = g_strdup_printf( "%s/.lxdream", home );
nkeynes@1038
    48
    }
nkeynes@1038
    49
    return user_data_path;
nkeynes@1241
    50
}
nkeynes@1241
    51
nkeynes@1241
    52
void set_user_data_path( const char *p ) 
nkeynes@1241
    53
{
nkeynes@1241
    54
    g_free(user_data_path);
nkeynes@1241
    55
    user_data_path = g_strdup(p);
nkeynes@1241
    56
}
nkeynes@1241
    57
nkeynes@1241
    58
const char *get_user_home_path()
nkeynes@1241
    59
{
nkeynes@1241
    60
    return getenv("HOME");
nkeynes@1038
    61
}
.