[redland-dev] Bug report

Dave Beckett dave.beckett at bristol.ac.uk
Tue Oct 21 17:42:08 BST 2003


On Tue, 21 Oct 2003 16:33:44 +0100, Paul Keogh <paul.keogh at anam.com> wrote: 
> It could all be down to the way I (ab)use your API. My code is
> 
> 	strcpy (scanpath, directory);
> 	strcat (scanpath, "/*.rdf");
> 
> 	if ((h = FindFirstFile (scanpath, &wfd)) == INVALID_HANDLE_VALUE) {
> 		error (0, "load_rdf_repository: Directory scan failed for (%s)", 
>directory);
> 		return -1;
> 	}
> 
> 	sprintf (rdffile, "file://%s/%s", directory, wfd.cFileName);
> 
> 	if ((uri = librdf_new_uri (world, rdffile)) == NULL) {

Why not librdf_new_uri_from_filename(world, wfd.cFileName) ? At least
that way the URI that is constructed should get out the same filename
you put in.

If you need the full path, there must be some sensible way to join the directory
and filename.

> 		error (0, "load_rdf_repository: librdf_new_uri() failed for (%s)",
> rdffile);
> 		FindClose (h);
> 		return -1;
> 	}
> 
> where directory = c:\...
> 
> I need to specify a drive identifier because redland calls fopen() to
> ultimately load
> the RDF file. So I guess there is a bug and looking for : in the authority
> part fixes it nicely.

I'm vaguely unsure if : in a URI authority is allowed; it probably doesn't
matter.  So I'm still not sure what change is needed.

> I think there is a function in an MS Internet SDK to parse URIs but I think
> its better to roll your own.

OK.

Dave




More information about the redland-dev mailing list