Developer forums (C::B DEVELOPMENT STRICTLY!) > Development

Minor enhancement of "External dependencies" GUI

<< < (2/3) > >>

thomas:

--- Quote from: MortenMacFly on February 13, 2006, 11:18:07 am ---I have to change around 40 project files in this way because the names of libraries have changed so this will certainly increase my productivity, really!
--- End quote ---
Lol, you know I am normally strictly against doing such things. But changing the dependency names in 40(!) projects really justifies running a global search/replace on the project files using sed or a text editor or whatever... :lol:

You know, sed does that as a one-liner... :)

MortenMacFly:

--- Quote from: thomas on February 13, 2006, 11:21:34 am ---You know, sed does that as a one-liner... :)

--- End quote ---
Well, it's not so easy, because it's target dependend. I got debug-libs for the external dependencies so I want really only the debug-target-dependencies to be changed. A search & replace would also change all the other targets as well. Furthermore I trust C::B more than a search & replace tool. And I am addicted to GUIs. :lol:
Morten.

thomas:
Changing 40 projects manually one by one will take you 60-70 minutes (estimated).

You could probably write a TinyXML-based application which selectively replaces that one one node (in the respective target) in less than 10 minutes. That would be a lot faster, less annoying, and just as safe.
If there is a lot of work that is outright annoying and stupid like this, then I always say "Hey, what do I have a computer for!" :)

MortenMacFly:

--- Quote from: thomas on February 13, 2006, 11:34:05 am ---You could probably write a TinyXML-based application which [...]

--- End quote ---
Too late, I've finished by now. :?
Morten.

thomas:
What a shame... something like this would probably have done it:
--- Code: ---#include <stdio.h>
#include "tinyxml/tinystr.h"
#include "tinyxml/tinyxml.h"

int main(int argc, char** argv)
{

TiXmlDocument doc(argv[0]);

TiXmlElement *build = doc.FirstChildElement( "CodeBlocks_project_file")->FirstChildElement( "Project")->FirstChildElement( "Build");

if(!build)
return -1;

TiXmlElement *target = 0;

while(target = (TiXmlElement*) build->IterateChildren("Target", target))
{
if(target->Attribute("title") && !strcmp(target->Attribute("title"), "debug"))
{
TiXmlElement *opts = 0;
while(opts = (TiXmlElement*) target->IterateChildren("Option", opts))
{
if(opts->Attribute("external_deps") && !strcmp(opts->Attribute("external_deps"), "oldLibraryName"))
opts->SetAttribute("external_deps", "newLibraryName");
}
}
}

doc.SaveFile();

return 0;
}
--- End code ---
I haven't tried whether it even compiles, might be there are a couple of typos in it, but you get the idea... :)

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version