On Wed, 2006-11-01 at 20:52 +0000, Roger James wrote: > The current implementation of the Collada writer sometimes generates > <init_from> elements on Windows that look like this. > > > > <init_from>../../../../C:/Environ% > 20Project/environ/TerrainData/vtp-apps-data-and-plantlib/BuildingModels/cement_block1_256.jpg</init_from>
As far as a relative URL goes it's valid. The "C:" path-part is not special in that regard. > If you try to reimport this file then the texture image is not found > due to the fact that this is an invalid file name as far as windows is > concerned. Well it's not a file name at all. It's a relative URL that has to be converted to a native name on the local filesystem, in this case Windows. > The problem is cause by the following call > > imgif->getValue().makeRelativeTo( doc->getDocumentURI() ); If you read the COLLADA DOM docs you'll find that makeRelativeTo() is an experimental function. It obviously needs a bit more work. > Where the image URI looks like this > > “file:///C:/Environ > Project/environ/TerrainData/vtp-apps-data-and-plantlib/BuildingModels/cement_block1_256.jpg” > > and the document URI > > file:///c:/temp/colladatest/models/brantholme.dae > > > Notice that drive letter parts of the URI are different case. Okay and in a URI path they are different because... > The problem appears to be that the makeRelativeTo method does a case > sensitive comparison of the path segments. According to RFC 3986 section 6.2.2.1, the path component of a generic syntax URL is considered to be case-sensitive unless defined otherwise by the scheme, in this case file:. According to RFC 1738 section 3.10 the file scheme makes no such exception for its fpath part. Needless to say it's a longstanding headache for developers. > Windows paths are case insensitive. This is technically irrelevent since makeRelativeTo() is a URI function. It must follow the rules for processing URI. I don't think it's appropriate for it to perform normalizations that are not defined in the RFC (above). > I suggest that the safest place were we can make assumptions about the > platform we are running on is in the plugin code itself not in the > Collada dae. I agree with you on this. > So on windows maybe we should force the image URI to lower case and > make a temporary lower case copy of the Document URI before calling > the make relative method. A reasonable solution! This is a similar workaround to Apache's ( http://httpd.apache.org/docs/1.3/mod/mod_speling.html ) mod to hide case correctness from millions of Web users in the name of usability. > I don’t know if this is the only place we are going to run into this > kind of problem. You'll run into it everywhere Windows systems interact with the rest of the Internet ;) Regards, Marcus _______________________________________________ osg-users mailing list [email protected] http://openscenegraph.net/mailman/listinfo/osg-users http://www.openscenegraph.org/
