Update of /cvsroot/openvrml/openvrml/examples
In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv5598/examples
Modified Files:
Tag: OpenVRML-0_16-BRANCH
sdl_viewer.cpp
Log Message:
Fixed relative URI resolution on Windows.
Index: sdl_viewer.cpp
===================================================================
RCS file: /cvsroot/openvrml/openvrml/examples/sdl_viewer.cpp,v
retrieving revision 1.10.2.1
retrieving revision 1.10.2.2
diff -C2 -d -r1.10.2.1 -r1.10.2.2
*** sdl_viewer.cpp 31 Aug 2006 21:18:57 -0000 1.10.2.1
--- sdl_viewer.cpp 5 Dec 2006 21:15:09 -0000 1.10.2.2
***************
*** 209,218 ****
"supported");
}
//
// file://
// ^
// 01234567
//
! string path = uri.substr(uri.find_first_of('/', 7));
auto_ptr<resource_istream> in(new file_resource_istream(path));
--- 209,234 ----
"supported");
}
+
//
// file://
// ^
// 01234567
+ static const string::size_type authority_start_index = 7;
+
//
! // On Windows we want to start at the drive letter, which is after the
! // first slash in the path.
! //
! // We ignore the content of the authority; a smarter implementation
! // should confirm that it is localhost, the machine name, or zero
! // length.
! //
! string::size_type path_start_index =
! # ifdef _WIN32
! uri.find_first_of('/', authority_start_index) + 1;
! # else
! uri.find_first_of('/', authority_start_index);
! # endif
! string path = uri.substr(path_start_index);
auto_ptr<resource_istream> in(new file_resource_istream(path));
|