static gboolean amp_module_node_write (AmpNode *node, AmpNode *amp_parent, AmpProject *project, GError **error) { AnjutaProjectNode *parent = ANJUTA_PROJECT_NODE (amp_parent); if ((parent != NULL) && (anjuta_project_node_get_node_type (parent) == ANJUTA_PROJECT_TARGET)) { AnjutaProjectNode *group = anjuta_project_node_parent (parent); AnjutaProjectPropertyInfo *group_cpp; AnjutaProjectPropertyInfo *target_cpp; AnjutaProjectPropertyInfo *target_lib; gchar *lib_flags; gchar *cpp_flags; gint type; group_cpp = amp_node_get_property_info_from_token (group, AM_TOKEN__CPPFLAGS, 0); type = anjuta_project_node_get_full_type (parent) & (ANJUTA_PROJECT_ID_MASK | ANJUTA_PROJECT_TYPE_MASK); switch (type) { case ANJUTA_PROJECT_TARGET | ANJUTA_PROJECT_PROGRAM: target_lib = amp_node_get_property_info_from_token (parent, AM_TOKEN_TARGET_LDADD, 0); break; case ANJUTA_PROJECT_TARGET | ANJUTA_PROJECT_STATICLIB: case ANJUTA_PROJECT_TARGET | ANJUTA_PROJECT_SHAREDLIB: case ANJUTA_PROJECT_TARGET | ANJUTA_PROJECT_LT_MODULE: target_lib = amp_node_get_property_info_from_token (parent, AM_TOKEN_TARGET_LIBADD, 0); break; default: break; } target_cpp = amp_node_get_property_info_from_token (parent, AM_TOKEN_TARGET_CPPFLAGS, 0); lib_flags = g_strconcat ("$(", anjuta_project_node_get_name (ANJUTA_PROJECT_NODE (node)), "_LIBS)", NULL); cpp_flags = g_strconcat ("$(", anjuta_project_node_get_name (ANJUTA_PROJECT_NODE (node)), "_CFLAGS)", NULL); if (!amp_node_property_has_flags (group, group_cpp->id, cpp_flags) && !amp_node_property_has_flags (ANJUTA_PROJECT_NODE (parent), target_cpp->id, cpp_flags)) { AnjutaProjectProperty *prop; prop = amp_node_property_add_flags (group, group_cpp->id, cpp_flags); amp_project_update_am_property (project, group, prop); } if (!amp_node_property_has_flags (parent, target_lib->id, lib_flags)) { AnjutaProjectProperty *prop; prop = amp_node_property_add_flags (parent, target_lib->id, lib_flags); amp_project_update_am_property (project, parent, prop); } g_free (lib_flags); g_free (cpp_flags); return TRUE; } else { return amp_module_node_create_token (project, AMP_MODULE_NODE (node), error); } }
static AmpNode * amp_target_node_copy (AmpNode *old_node) { AmpNode *new_node; new_node = AMP_NODE_CLASS (amp_target_node_parent_class)->copy (old_node); amp_target_node_set_type (AMP_TARGET_NODE (new_node), anjuta_project_node_get_full_type (ANJUTA_PROJECT_NODE (old_node))); return new_node; }
void gbf_project_model_add_node (GbfProjectModel *model, AnjutaProjectNode *node, GtkTreeIter *parent) { GtkTreeIter iter; GbfTreeData *data; AnjutaProjectNode *child; AnjutaProjectNodeType child_types[] = {ANJUTA_PROJECT_GROUP, ANJUTA_PROJECT_TARGET, ANJUTA_PROJECT_SOURCE, ANJUTA_PROJECT_MODULE, ANJUTA_PROJECT_PACKAGE, 0}; AnjutaProjectNodeType *type; if (node == NULL) return; data = gbf_tree_data_new_node (node); gtk_tree_store_append (GTK_TREE_STORE (model), &iter, parent); gtk_tree_store_set (GTK_TREE_STORE (model), &iter, GBF_PROJECT_MODEL_COLUMN_DATA, data, -1); /* add children */ for (type = child_types; *type != 0; type++) { for (child = anjuta_project_node_first_child (node); child != NULL; child = anjuta_project_node_next_sibling (child)) { if (anjuta_project_node_get_node_type (child) == *type) { gbf_project_model_add_node (model, child, &iter); } } } /* Add shortcut if needed */ if ((data != NULL) && model->priv->default_shortcut && (anjuta_project_node_get_node_type (node) == ANJUTA_PROJECT_TARGET) && (anjuta_project_node_get_full_type (node) & ANJUTA_PROJECT_PRIMARY)) { gbf_project_model_add_target_shortcut (model, NULL, data, NULL, NULL); } }
GList * gbf_project_util_node_all (AnjutaProjectNode *parent, AnjutaProjectNodeType type) { AnjutaProjectNode *node; GList *list = NULL; gint type_id; gint type_flag; gint type_type; type_type = type & ANJUTA_PROJECT_TYPE_MASK; type_flag = type & ANJUTA_PROJECT_FLAG_MASK; type_id = type & ANJUTA_PROJECT_ID_MASK; for (node = anjuta_project_node_first_child (parent); node != NULL; node = anjuta_project_node_next_sibling (node)) { GList *child_list; if ((type_type == 0) || (anjuta_project_node_get_node_type (node) == type_type)) { gint type; type = anjuta_project_node_get_full_type (node); if (((type_id == 0) || (type_id == (type & ANJUTA_PROJECT_ID_MASK))) && ((type_flag == 0) || ((type & type_flag) != 0))) { list = g_list_prepend (list, node); } } child_list = gbf_project_util_node_all (node, type); child_list = g_list_reverse (child_list); list = g_list_concat (child_list, list); } list = g_list_reverse (list); return list; }
static gboolean amp_module_node_erase (AmpNode *node, AmpNode *amp_parent, AmpProject *project, GError **error) { AnjutaProjectNode *parent = ANJUTA_PROJECT_NODE (amp_parent); if ((parent != NULL) && (anjuta_project_node_get_node_type (parent) == ANJUTA_PROJECT_TARGET)) { AnjutaProjectNode *group = anjuta_project_node_parent (parent); AnjutaProjectProperty *prop; AnjutaProjectPropertyInfo *group_cpp; AnjutaProjectPropertyInfo *target_cpp; AnjutaProjectPropertyInfo *target_lib; gchar *lib_flags; gchar *cpp_flags; gint type; lib_flags = g_strconcat ("$(", anjuta_project_node_get_name (ANJUTA_PROJECT_NODE (node)), "_LIBS)", NULL); cpp_flags = g_strconcat ("$(", anjuta_project_node_get_name (ANJUTA_PROJECT_NODE (node)), "_CFLAGS)", NULL); group_cpp = amp_node_get_property_info_from_token (group, AM_TOKEN__CPPFLAGS, 0); if (amp_node_property_has_flags (group, group_cpp->id, cpp_flags)) { /* Remove flags in group variable if not more target has this module */ gboolean used = FALSE; AnjutaProjectNode *target; for (target = anjuta_project_node_first_child (ANJUTA_PROJECT_NODE (group)); target != NULL; target = anjuta_project_node_next_sibling (target)) { if (anjuta_project_node_get_node_type (target) == ANJUTA_PROJECT_TARGET) { AnjutaProjectNode *module; for (module = anjuta_project_node_first_child (target); module != NULL; module = anjuta_project_node_next_sibling (module)) { if ((anjuta_project_node_get_node_type (module) == ANJUTA_PROJECT_MODULE) && (module != ANJUTA_PROJECT_NODE (node)) && (strcmp (anjuta_project_node_get_name (module), anjuta_project_node_get_name (ANJUTA_PROJECT_NODE (node))) == 0)) { used = TRUE; break; } } } if (used) break; } if (!used) { AnjutaProjectProperty *prop; prop = amp_node_property_remove_flags (group, group_cpp->id, cpp_flags); if (prop != NULL) amp_project_update_am_property (project, group, prop); } } type = anjuta_project_node_get_full_type (ANJUTA_PROJECT_NODE (parent)) & (ANJUTA_PROJECT_ID_MASK | ANJUTA_PROJECT_TYPE_MASK); switch (type) { case ANJUTA_PROJECT_TARGET | ANJUTA_PROJECT_PROGRAM: target_lib = amp_node_get_property_info_from_token (parent, AM_TOKEN_TARGET_LDADD, 0); break; case ANJUTA_PROJECT_TARGET | ANJUTA_PROJECT_STATICLIB: case ANJUTA_PROJECT_TARGET | ANJUTA_PROJECT_SHAREDLIB: case ANJUTA_PROJECT_TARGET | ANJUTA_PROJECT_LT_MODULE: target_lib = amp_node_get_property_info_from_token (parent, AM_TOKEN_TARGET_LIBADD, 0); break; default: target_lib = NULL; break; } target_cpp = amp_node_get_property_info_from_token (parent, AM_TOKEN_TARGET_CPPFLAGS, 0); prop = amp_node_property_remove_flags (parent, target_cpp->id, cpp_flags); if (prop != NULL) amp_project_update_am_property (project, parent, prop); prop = amp_node_property_remove_flags (parent, target_lib->id, lib_flags); if (prop != NULL) amp_project_update_am_property (project, parent, prop); g_free (lib_flags); g_free (cpp_flags); return TRUE; } else { return amp_module_node_delete_token (project, AMP_MODULE_NODE (node), error); } }
/* Find if pkg-config modules are used in group targets */ static gboolean project_load_group_module (AmpProject *project, AmpGroupNode *group) { AnjutaProjectNode *target; AnjutaProjectProperty *prop; gchar **group_cpp = NULL; prop = amp_node_get_property_from_token (ANJUTA_PROJECT_NODE (group), AM_TOKEN__CPPFLAGS, 0); if (prop && (prop->value != NULL)) group_cpp = g_strsplit_set (prop->value, " \t", 0); /* Check all targets */ for (target = anjuta_project_node_first_child (ANJUTA_PROJECT_NODE (group)); target != NULL; target = anjuta_project_node_next_sibling (target)) { gint type = anjuta_project_node_get_full_type (target) & (ANJUTA_PROJECT_ID_MASK | ANJUTA_PROJECT_TYPE_MASK); gchar **target_lib = NULL; gchar **target_cpp = NULL; prop = NULL; switch (type) { case ANJUTA_PROJECT_TARGET | ANJUTA_PROJECT_PROGRAM: prop = amp_node_get_property_from_token (target, AM_TOKEN_TARGET_LDADD, 0); break; case ANJUTA_PROJECT_TARGET | ANJUTA_PROJECT_STATICLIB: case ANJUTA_PROJECT_TARGET | ANJUTA_PROJECT_SHAREDLIB: case ANJUTA_PROJECT_TARGET | ANJUTA_PROJECT_LT_MODULE: prop = amp_node_get_property_from_token (target, AM_TOKEN_TARGET_LIBADD, 0); break; default: break; } if (prop && (prop->value != NULL)) target_lib = g_strsplit_set (prop->value, " \t", 0); /* Check if targets use libraries */ if (target_lib != NULL) { AnjutaProjectNode *module; prop = amp_node_get_property_from_token (target, AM_TOKEN_TARGET_CPPFLAGS, 0); if (prop && (prop->value != NULL)) target_cpp = g_strsplit_set (prop->value, " \t", 0); for (module = anjuta_project_node_first_child (ANJUTA_PROJECT_NODE (project)); module != NULL; module = anjuta_project_node_next_sibling (module)) { if (anjuta_project_node_get_node_type (module) == ANJUTA_PROJECT_MODULE) { const gchar *name = anjuta_project_node_get_name (module); gchar *lib_flags = g_strconcat ("$(", name, "_LIBS)", NULL); gchar **flags; for (flags = target_lib; *flags != NULL; flags++) { if (strcmp (*flags, lib_flags) == 0) { gchar *cpp_flags = g_strconcat ("$(", name, "_CFLAGS)", NULL); gchar **cflags; gboolean found = FALSE; if (group_cpp != NULL) { for (cflags = group_cpp; *cflags != NULL; cflags++) { if (strcmp (*cflags, cpp_flags) == 0) { found = TRUE; break; } } } if ((target_cpp != NULL) && !found) { for (cflags = target_cpp; *cflags != NULL; cflags++) { if (strcmp (*cflags, cpp_flags) == 0) { found = TRUE; break; } } } if (found) { /* Add new module */ AnjutaProjectNode *new_module; new_module = amp_node_new_valid (target, ANJUTA_PROJECT_MODULE, NULL, name, NULL); anjuta_project_node_append (target, new_module); } g_free (cpp_flags); } } g_free (lib_flags); } } g_strfreev (target_cpp); g_strfreev (target_lib); } } g_strfreev (group_cpp); return TRUE; }
gboolean amp_target_node_create_token (AmpProject *project, AmpTargetNode *target, GError **error) { AnjutaToken *args; AnjutaToken *var; AnjutaToken *prev; AmpNodeInfo *info; gchar *targetname; const gchar *name; GList *last; AnjutaProjectNode *sibling; AmpGroupNode *parent; gboolean after; /* Get parent target */ parent = AMP_GROUP_NODE (anjuta_project_node_parent_type (ANJUTA_PROJECT_NODE (target), ANJUTA_PROJECT_GROUP)); info = (AmpNodeInfo *)amp_project_get_type_info (project, anjuta_project_node_get_full_type (ANJUTA_PROJECT_NODE (target))); name = anjuta_project_node_get_name (ANJUTA_PROJECT_NODE (target)); /* Find a sibling if possible */ after = TRUE; for (sibling = anjuta_project_node_prev_sibling (ANJUTA_PROJECT_NODE (target)); sibling != NULL; sibling = anjuta_project_node_prev_sibling (sibling)) { if (anjuta_project_node_get_node_type (sibling) == ANJUTA_PROJECT_TARGET) break; } if (sibling == NULL) { after = FALSE; for (sibling = anjuta_project_node_next_sibling (ANJUTA_PROJECT_NODE (target)); sibling != NULL; sibling = anjuta_project_node_next_sibling (sibling)) { if (anjuta_project_node_get_node_type (sibling) == ANJUTA_PROJECT_TARGET) break; } } if (sibling == NULL) after = TRUE; /* Add in Makefile.am */ targetname = g_strconcat (amp_target_node_get_install_directory (target) != NULL ? amp_target_node_get_install_directory (target) : info->install, "_", info->prefix, NULL); // Get token corresponding to sibling and check if the target are compatible args = NULL; var = NULL; prev = NULL; if (sibling != NULL) { last = amp_target_node_get_token (AMP_TARGET_NODE (sibling), ANJUTA_TOKEN_ARGUMENT); if (last != NULL) { AnjutaToken *token = (AnjutaToken *)last->data; /* Check that the sibling is of the same kind */ token = anjuta_token_list (token); if (token != NULL) { token = anjuta_token_list (token); var = token; if (token != NULL) { token = anjuta_token_first_item (token); if (token != NULL) { gchar *value; value = anjuta_token_evaluate (token); if ((value != NULL) && (strcmp (targetname, value) == 0)) { g_free (value); prev = (AnjutaToken *)last->data; args = anjuta_token_list (prev); } } } } } } /* Check if a valid target variable is already defined */ if (args == NULL) { for (last = amp_group_node_get_token (parent, AM_GROUP_TARGET); last != NULL; last = g_list_next (last)) { gchar *value = anjuta_token_evaluate (anjuta_token_first_word ((AnjutaToken *)last->data)); if ((value != NULL) && (strcmp (targetname, value) == 0)) { g_free (value); args = anjuta_token_last_item ((AnjutaToken *)last->data); break; } g_free (value); } } if (args == NULL) { args = amp_project_write_target (parent, info->token, targetname, FALSE, NULL); } g_free (targetname); switch (anjuta_project_node_get_full_type (ANJUTA_PROJECT_NODE (target)) & ANJUTA_PROJECT_ID_MASK) { case ANJUTA_PROJECT_SHAREDLIB: case ANJUTA_PROJECT_STATICLIB: case ANJUTA_PROJECT_LT_MODULE: case ANJUTA_PROJECT_PROGRAM: amp_target_add_in_list (project, args, ANJUTA_PROJECT_NODE (target), after, prev); break; default: if (args != NULL) { amp_target_node_add_token (target, AM_TOKEN__SOURCES, args); } break; } return TRUE; }
static AnjutaToken * amp_property_rename_target (AmpProject *project, AnjutaProjectNode *node) { AnjutaProjectNode *group; GList *infos; GList *item; GString *new_name; AmpNodeInfo *info; GList *list; AnjutaToken *update = NULL; AnjutaToken *existing_target_list; gboolean after; gchar *target_dir; g_return_val_if_fail (anjuta_project_node_get_node_type (node) == ANJUTA_PROJECT_TARGET, NULL); group = anjuta_project_node_parent_type (node, ANJUTA_PROJECT_GROUP); /* Find all program properties */ infos = NULL; for (item = anjuta_project_node_get_properties_info (node); item != NULL; item = g_list_next (item)) { AmpPropertyInfo *info = (AmpPropertyInfo *)item->data; if (info->token_type == AM_TOKEN__PROGRAMS) { infos = g_list_insert_sorted (infos, info, compare_property_position); } } /* Create new name */ new_name = g_string_new (NULL); for (item = infos; item != NULL; item = g_list_next (item)) { AmpPropertyInfo *info = (AmpPropertyInfo *)item->data; AmpProperty *prop; /* Check if property is enabled by another property */ if (info->link != NULL) { AnjutaProjectProperty *en_prop; en_prop = anjuta_project_node_get_property (node, info->link->id); if ((en_prop->value != NULL) && (*en_prop->value == '1')) continue; } prop = (AmpProperty *)anjuta_project_node_get_property (node, info->base.id); if ((prop == (AmpProperty *)info->base.default_value) || (g_strcmp0 (prop->base.value, info->base.default_value->value) == 0)) { /* Default value, add only string properties */ if (info->base.type == ANJUTA_PROJECT_PROPERTY_STRING) { g_string_append (new_name, info->suffix); g_string_append_c (new_name, '_'); } } else { switch (info->base.type) { case ANJUTA_PROJECT_PROPERTY_STRING: if ((info->flags & AM_PROPERTY_DIRECTORY) && (strlen (prop->base.value) > 4) && (strcmp (prop->base.value + strlen (prop->base.value) - 3, "dir") == 0)) { /* Remove "dir" suffix */ g_string_append_len (new_name, prop->base.value, strlen (prop->base.value) - 3); } else { g_string_append (new_name, prop->base.value); } g_string_append_c (new_name, '_'); break; case ANJUTA_PROJECT_PROPERTY_BOOLEAN: if ((prop->base.value != NULL) && (g_strcmp0 (prop->base.value, info->base.default_value->value) != 0)) { g_string_append (new_name, info->suffix); } break; default: break; } } } info = (AmpNodeInfo *)amp_project_get_type_info (project, anjuta_project_node_get_full_type (node)); g_string_append (new_name, info->prefix); if ((anjuta_project_node_get_full_type (node) & ANJUTA_PROJECT_ID_MASK) == ANJUTA_PROJECT_DATA) { list = amp_target_node_get_token (AMP_TARGET_NODE (node), AM_TOKEN__DATA); if ((list != NULL) && (list->data != NULL)) { AnjutaToken *old_token; AnjutaToken *parent; parent = (AnjutaToken *)list->data; old_token = anjuta_token_first_word (parent); if (old_token != NULL) { AnjutaToken *token; token = anjuta_token_new_string (ANJUTA_TOKEN_ADDED, new_name->str); update = anjuta_token_insert_word_after (parent, old_token, token); anjuta_token_remove_word (old_token); update = parent; } } } else { // Check if the target already exist. after = TRUE; for (item = amp_group_node_get_token (AMP_GROUP_NODE (group), AM_GROUP_TARGET); item != NULL; item = g_list_next (item)) { existing_target_list = (AnjutaToken *)item->data; gchar *target_name = anjuta_token_evaluate (anjuta_token_first_word (existing_target_list)); gboolean same; same = strcmp (target_name, new_name->str) == 0; g_free (target_name); if (after) { GList *list; GList *item; list = amp_target_node_get_token (AMP_TARGET_NODE (node), ANJUTA_TOKEN_ARGUMENT); for (item = g_list_first (list); item != NULL; item = g_list_next (item)) { AnjutaToken *arg = (AnjutaToken *)item->data; AnjutaToken *target_list; if (arg != NULL) { target_list = anjuta_token_list (arg); if (anjuta_token_list (target_list) == existing_target_list) { /* token in group_node are stored in reverse order */ after = FALSE; break; } } } } if (same) { existing_target_list = anjuta_token_last_item (existing_target_list); break; } existing_target_list = NULL; } if (existing_target_list != NULL) { GList *token_list; /* Get old tokens */ token_list = g_list_copy (amp_target_node_get_token (AMP_TARGET_NODE (node), ANJUTA_TOKEN_ARGUMENT)); /* Add target in already existing list */ amp_target_add_in_list (project, existing_target_list, node, after, NULL); /* Remove old token */ amp_target_node_delete_token (project, AMP_TARGET_NODE (node), token_list, NULL); g_list_free (token_list); } else { list = amp_target_node_get_token (AMP_TARGET_NODE (node), ANJUTA_TOKEN_ARGUMENT); for (item = g_list_first (list); item != NULL; item = g_list_next (item)) { AnjutaToken *arg = (AnjutaToken *)item->data; AnjutaToken *target_list; if (arg == NULL) continue; target_list = anjuta_token_list (arg); if (anjuta_token_nth_word (target_list, 1) == NULL) { /* Only one target in list, just replace list name */ AnjutaToken *target_variable = anjuta_token_list (target_list); if (target_variable != NULL) { AnjutaToken *old_token; old_token = anjuta_token_first_word (target_variable); if (old_token != NULL) { AnjutaToken *token; token = anjuta_token_new_string (ANJUTA_TOKEN_ADDED, new_name->str); update = anjuta_token_insert_word_after (target_variable, old_token, token); anjuta_token_remove_word (old_token); update = target_variable; } } } else { gchar *old_target; AmpNodeInfo *info; gboolean after = TRUE; AnjutaToken *sibling = NULL; AnjutaTokenStyle *style; AnjutaToken *token; old_target = anjuta_token_evaluate (arg); /* Find sibling target */ if (anjuta_token_first_word (target_list) == arg) { sibling = anjuta_token_next_word (arg); after = FALSE; } else { for (sibling = anjuta_token_first_word (target_list); sibling != NULL; sibling = anjuta_token_next_word (sibling)) { if (anjuta_token_next_word (sibling) == arg) break; } after = TRUE; } /* More than one target, remove target in list */ arg = anjuta_token_remove_word (arg); if (arg != NULL) amp_group_node_update_makefile (AMP_GROUP_NODE (group), arg); /* Add target in new list */ style = anjuta_token_style_new_from_base (project->am_space_list); anjuta_token_style_update (style, target_list); info = (AmpNodeInfo *)amp_project_get_type_info (project, anjuta_project_node_get_full_type (node)); target_list = amp_project_write_target (AMP_GROUP_NODE (group), info->token, new_name->str, after, sibling); token = anjuta_token_new_string (ANJUTA_TOKEN_ARGUMENT | ANJUTA_TOKEN_ADDED, old_target); anjuta_token_insert_word_after (target_list, NULL, token); /* Try to use the same style than the current target list */ anjuta_token_style_format (style, target_list); anjuta_token_style_free (style); amp_group_node_update_makefile (AMP_GROUP_NODE (group), token); amp_target_node_add_token (AMP_TARGET_NODE (node), ANJUTA_TOKEN_ARGUMENT, token); g_free (old_target); update = anjuta_token_list (target_list); } } } } /* Add directory variable if needed */ target_dir = NULL; for (item = anjuta_project_node_get_properties (node); item != NULL; item = g_list_next (item)) { AmpProperty *prop = (AmpProperty *)item->data; if ((((AmpPropertyInfo *)prop->base.info)->token_type == AM_TOKEN__PROGRAMS) && (((AmpPropertyInfo *)prop->base.info)->flags & AM_PROPERTY_DIRECTORY)) { target_dir = prop->base.value; if ((strlen (target_dir) <= 3) || (strcmp (target_dir + strlen(target_dir) - 3, "dir") != 0)) { target_dir = g_strconcat (target_dir, "dir", NULL); g_free (prop->base.value); prop->base.value = target_dir; } break; } } /* If it is a standard directory do not add a variable*/ if (target_dir != NULL) { const gchar **std_dir; for (std_dir = AmpStandardDirectory; *std_dir != NULL; std_dir++) { if (strcmp(*std_dir, target_dir) == 0) { target_dir = NULL; break; } } } if (target_dir != NULL) { for (item = anjuta_project_node_get_properties (group); item != NULL; item = g_list_next (item)) { AmpProperty *prop = (AmpProperty *)item->data; if ((((AmpPropertyInfo *)prop->base.info)->token_type == AM_TOKEN_DIR) && (g_strcmp0 (prop->base.name, target_dir) == 0)) { /* Find already existing directory variable */ target_dir = NULL; break; } } } if ((update != NULL) && (target_dir != NULL)) { update = anjuta_token_insert_token_list (FALSE, update, AM_TOKEN_DIR, NULL, ANJUTA_TOKEN_NAME, target_dir, ANJUTA_TOKEN_SPACE, " ", ANJUTA_TOKEN_OPERATOR, "=", ANJUTA_TOKEN_SPACE, " ", ANJUTA_TOKEN_LIST, NULL, ANJUTA_TOKEN_SPACE, " ", ANJUTA_TOKEN_EOL, "\n", NULL); } g_string_free (new_name, TRUE); return update; }