Update of /cvsroot/openvrml/openvrml/examples
In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv6415/examples
Modified Files:
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.12
retrieving revision 1.13
diff -C2 -d -r1.12 -r1.13
*** sdl_viewer.cpp 22 Nov 2006 00:05:18 -0000 1.12
--- sdl_viewer.cpp 5 Dec 2006 21:16:21 -0000 1.13
***************
*** 203,212 ****
"supported");
}
//
// file://
// ^
// 01234567
//
! string path = uri.substr(uri.find_first_of('/', 7));
auto_ptr<resource_istream> in(new file_resource_istream(path));
--- 203,228 ----
"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));
|