Exemplo n.º 1
0
void
set_environment_tool_from_list( ASEnvironment *e, ASToolType type, char ** list, int list_len )
{
	int i ;
	destroy_string( &(e->tool_command[type]) );
	for( i = 0 ; i < list_len ; ++i ) 
		if( list[i] )
		{
			char *tmp = list[i] ;
			char *fullname = NULL ;
			if( tmp[0] == '$' ) 
				tmp = copy_replace_envvar( tmp );
			if( get_executable_in_path( tmp, &fullname ) ) 
			{
				e->tool_command[type] = fullname;
				break;
			}else
				show_warning( "%s command %s is not in the path", _as_tools_name[type], tmp );
			if (tmp != list[i])
				free(tmp);	  
		}	 
	if( e->tool_command[type] == NULL ) 
		e->tool_command[type] = as_get_default_tool(type);
	show_progress( "%s is set to: \"%s\"", _as_tools_name[type], e->tool_command[type]?e->tool_command[type]:"none" );
}
Exemplo n.º 2
0
char *make_session_rc_file( ASSession *session, const char *tmpl )
{
	
	if( tmpl == NULL ) 
		return NULL;
	
	if( tmpl[0] == '/' || tmpl[0] == '$' || tmpl[0] == '~' )
		return copy_replace_envvar (tmpl);
	
	return make_session_data_file(session, False, 0, tmpl, NULL );
}	 
Exemplo n.º 3
0
/*************************************************************************
 * Supplementary functionality to handle Base configuration changes.
 *************************************************************************/
void
ExtractPath (BaseConfig * config,
						 char **module_path,
						 char **sound_path,
						 char **icon_path,
						 char **pixmap_path,
						 char **font_path, char **cursor_path, char **myname_path,
						 char **gtkrc_path, char **gtkrc20_path)
{
	register char *tmp;

	if (config) {
		if (module_path && config->module_path) {
			tmp = copy_replace_envvar (config->module_path);
			set_string (module_path, tmp);
		}
		if (sound_path && config->sound_path) {
			tmp = copy_replace_envvar (config->sound_path);
			set_string (sound_path, tmp);
		}
		if (icon_path && config->icon_path) {
			tmp = copy_replace_envvar (config->icon_path);
			set_string (icon_path, tmp);
		}
		if (pixmap_path && config->pixmap_path) {
			tmp = copy_replace_envvar (config->pixmap_path);
			set_string (pixmap_path, tmp);
		}
		if (font_path && config->font_path) {
			tmp = copy_replace_envvar (config->font_path);
			set_string (font_path, tmp);
		}
		if (cursor_path && config->cursor_path) {
			tmp = copy_replace_envvar (config->cursor_path);
			set_string (cursor_path, tmp);
		}
		if (myname_path && config->myname_path) {
			tmp = copy_replace_envvar (config->myname_path);
			set_string (myname_path, tmp);
		}
		if (gtkrc_path && config->gtkrc_path) {
			tmp = make_session_rc_file (Session, config->gtkrc_path);
			set_string (gtkrc_path, tmp);
		}
		if (gtkrc20_path && config->gtkrc20_path) {
			tmp = make_session_rc_file (Session, config->gtkrc20_path);
			set_string (gtkrc20_path, tmp);
		}
	}
}
Exemplo n.º 4
0
char         *
make_absolute (const char *path1, const char *path2)
{
	char         *path;

	if( path1 == NULL || path2 == NULL )
		return mystrdup("./") ;
	if (*path2 == '/' || *path2 == '~' || *path2 == '$')
		path = copy_replace_envvar(path2);
	else
		/* relative path */
	{
		path = safemalloc (strlen ((char*)path1) + strlen ((char*)path2) + 2);
		sprintf (path, "%s/%s", path1, path2);
	}
	return path;
}
Exemplo n.º 5
0
char *as_get_default_tool(ASToolType type)
{
	int i ;							
	for( i = 0 ; _as_known_tools[type][i] ; ++i ) 
	{
		char *tmp = _as_known_tools[type][i] ;
		char *fullname = NULL ;
		int res ;
		if( tmp[0] == '$' ) 
			tmp = copy_replace_envvar( tmp );
		res = get_executable_in_path (tmp, &fullname);
		if (tmp != _as_known_tools[type][i])
			free( tmp );
		if( res > 0 )
			return fullname;
	}
	return NULL;
}
Exemplo n.º 6
0
Bool
add_KDE_colorscheme( const char *new_cs_file ) 
{
	Bool success = False; 
#define KDE_CSRC_PATH  		"$KDEHOME/share/apps/kdisplay/color-schemes/"
	
	if( new_cs_file ) 
	{	
		int i = 1;
		char *dst_path ;
		char *dst_full_fname ; 
		char *fname  = NULL ; 

		parse_file_name(new_cs_file, NULL, &fname );
		dst_path = copy_replace_envvar( KDE_CSRC_PATH );
		
		while( dst_path[i] != '\0' ) 
		{	
			if( dst_path[i] == '/' ) 
			{
				char t = dst_path[i];
				dst_path[i] = '\0' ; 
				if (CheckDir (dst_path) != 0)
					mkdir (dst_path, 0755);
				dst_path[i] = t ;
			}
			++i;
		}			   

		dst_full_fname = safemalloc( i+strlen(fname)+1 );
		sprintf( dst_full_fname, "%s%s", dst_path, fname );
		success = (CopyFile( new_cs_file, dst_full_fname )==0);

		free( dst_full_fname );
		free( dst_path );
		free( fname );
	}

	return success;
}