windows full paths in collada dom

hi

i am trying to load a collada file in a qt4 cross-platform env. on linux everything works fine, but on windows it seems to have trouble with the fully qualified system paths. this is the code (i put the example file in all the mentioned directories for testing):

bool
GraphWidget::loadFile(const QString &fileName)
{
int error;
DAE *doc = new DAE;
std::string bla = fileName.toStdString();
error = doc->load(fileName.toStdString().c_str()); // this doesn’t work with error = -100
error = doc->load(“example.dae”); // this works
error = doc->load("…/example.dae"); //this works
error = doc->load(“D:/SADA/TerminalEditor/TE_GUI/example.dae”); //this doesn’t work with error = -100

if (error != DAE_OK)
{
	return false;
}
QVector<domGeometry *> geometryNodes = ColladaLoader::getGeometries(doc);

return true;

}

i guess, this has to do with the IOPlugin used, but what can i acutally do to support windows fully qualified paths?

thanks!

I think it has to be a valid URI for it to work. “example.dae” and “…/example.dae” are valid URIs, but “C:/whatever” isn’t. Add “file:///” to the front to make it valid. Also when you do it that way I think backslashes are fine. I use “file:///C:\myFile.dae” and it works.

sthomas is right.
The COLLADA DOM uses URI’s not filenames. “example.dae” and “…/example.dae” are valid relative URIs. A full windows path is not a valid URI.
if you prefix the path with a ‘/’ character you turn the filepath into a relative URI. if you prefix the URI with “file:///” you create an absolute URI.

To make the URIs valid you need to convert ''s into '/'s. The COLLADA DOM may support both types of slashes in the path, and even mixtures, but I think thats a side effect of using libxml2. Because libxml2 doesn’t care the DOM doesn’t care. But if you were to switch to a different IO plugin it may not work correctly.

Also not all DOM functions will work when you have incorrect slashes. Functions such as daeURI::makeRelativeTo search specificly for a ‘/’.

-Andy

Ah, didn’t know that. Thanks.