libplist API does not offer a way to clone or modify nodes
-
Jonathan Beck
- State changed from new to open
- Assigned user set to Jonathan Beck
Hi Martin,
I updated libplist git HEAD with requested changes.
Please check that it fits your needs.Also I would like to ensure through API that dicts are always well formed (key/value pairs), but that would require to duplicate lots of functions in the API (as single node manipulation is still necessary to handle arrays), so I don't really know what to do here.
If you did not started yet, I will probably investigate making a GUI plist editor.
-
Martin S.
Superb, thanks for looking into this. However I get empty nodes back...
static plist_t plist_copy_node(GNode * node, gpointer parent_node) { plist_t newnode = NULL; plist_data_t data = plist_get_data(node); plist_data_t newdata = plist_new_plist_data(); assert(data); // plist should always have data memcpy(newdata, data, sizeof(struct plist_data_s)); newnode = plist_new_node(newdata); if (parent_node) { g_node_append(parent_node, newnode); } g_node_children_foreach(node, G_TRAVERSE_ALL, plist_copy_node, newnode); } plist_t plist_copy(plist_t node) { plist_copy_node(node, NULL); }... as above obviously can't work returning void. :)
-
Jonathan Beck
I obviously did that a bit too fast :). Strange gcc didn't moan about that though.
Should be fixed now.
-
Martin S.
Attached patch fixes the last issue I encountered with this. After applying it everything works as expected. Thanks a lot.
-
Martin S.
Well, forgot to also copy the string value for "key" which caused issues. Attached corrected patch to use instead of the one before.
Please Sign in or create a free account to add a new ticket.
With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.
