1.1 --- a/src/config.c Thu Jun 25 01:15:25 2009 +0000
1.2 +++ b/src/config.c Fri Jun 26 05:47:04 2009 +0000
1.11 -#include <wordexp.h>
1.12 #include <glib/gmem.h>
1.13 #include <glib/gstrfuncs.h>
1.14 #include <sys/types.h>
1.15 #include <sys/stat.h>
1.18 +#include "lxpaths.h"
1.19 #include "maple/maple.h"
1.21 #define MAX_ROOT_GROUPS 16
1.22 @@ -196,82 +195,6 @@
1.26 -gchar *get_expanded_path( const gchar *input )
1.29 - if( input == NULL ) {
1.32 - memset(&we,0,sizeof(we));
1.33 - int result = wordexp(input, &we, WRDE_NOCMD);
1.34 - if( result != 0 || we.we_wordc == 0 ) {
1.35 - /* On failure, return the original input unchanged */
1.36 - return g_strdup(input);
1.38 - /* On success, concatenate all 'words' together into a single
1.39 - * space-separated string
1.41 - int length = we.we_wordc, i;
1.42 - gchar *result, *p;
1.44 - for( i=0; i<we.we_wordc; i++ ) {
1.45 - length += strlen(we.we_wordv[i]);
1.47 - p = result = g_malloc(length);
1.48 - for( i=0; i<we.we_wordc; i++ ) {
1.51 - strcpy( p, we.we_wordv[i] );
1.60 - * Test if we need to escape a path to prevent substitution mangling.
1.61 - * @return TRUE if the input value contains any character that doesn't
1.62 - * match [a-zA-Z0-9._@%/] (this will escape slightly more than it needs to,
1.65 -gboolean path_needs_escaping( const gchar *value )
1.67 - const gchar *p = value;
1.69 - if( !isalnum(*p) && *p != '.' && *p != '_' &&
1.70 - *p != '@' && *p != '%' && *p != '/' ) {
1.78 -gchar *get_escaped_path( const gchar *value )
1.80 - if( value != NULL && path_needs_escaping(value) ) {
1.81 - /* Escape with "", and backslash the remaining characters:
1.84 - char buf[strlen(value)*2+3];
1.85 - const char *s = value;
1.89 - if( *s == '\\' || *s == '"' || *s == '$' || *s == '`' ) {
1.96 - return g_strdup(buf);
1.98 - return g_strdup(value);
1.102 gchar *lxdream_get_global_config_path_value( int key )
1.104 const gchar *str = lxdream_get_global_config_value(key);