I’m writing a utility to update egg files with relative pathnames, and I’m a bit stuck.
I’m using the string.find function to find the start of a texture reference.
What I want to find is:
{
"
I’m not sure if I need to include the cr/lf in the search string, and the ending quotes is a problem.
So what I need is: do I need to include the cr/lf in the search string, and how do I handle the quotes?
you can use single-quotes for that , like {" or “{’” if you need it the other way round.
you can use pythons replace() function to just get rid of all those whitespaces, tabs and newlines and then search for {"
Hmm, I would personally use EggData classes for that, just load the .egg file, iterate through the nodes, replace all paths, and save it again.
Maybe you could do it with a smart regexp as well.
You could just search for “([a-zA-Z]):\” and replace it with “/$1/”, and find “\” and replace it with “/”.