[Mapserver-dev] msBuildPath etc...
Steve Lime
steve.lime at dnr.state.mn.us
Tue Feb 4 23:52:56 EST 2003
Frank: You may want to have a look-see at mapraster.c in
msDrawRasterLayerLow to make sure I didn't screw anything up. I only
touched the tile checking code but see that the path building functions
are used lots of places. Note that the shapefile and dbf opening code
looks in shapepath, and if it doesn't exist there (even if shapepath
exists) in mappath. The raster code does not do that check. Perhaps we
don't want to do it for shapefiles either but that's how it's coded now.
Steve
Stephen Lime
Data & Applications Manager
Minnesota DNR
500 Lafayette Road
St. Paul, MN 55155
651-297-2937
>>> Daniel Morissette <morissette at dmsolutions.ca> 02/03/03 22:40 PM >>>
Steve Lime wrote:
>
> Hi folks: I'd like to ditch passing shapepath around to msOpenLayer
and
> the shapefile routines. What's the best way to use the various
> msBuildPath functions to do that? For the shapefile (and Xbase
> functions) i'd like to simply pass the final file name. The logic (I
> think) would be:
>
> - if DATA or TABLE is full path, then use it
> - if DATA or TABLE relative, and SHAPEPATH is valid then append it
> - if SHAPEPATH relative, then append MAPPATH
>
> If those that wrote those functions would help with their
interpretation
> that would be great.
>
Hi Steve,
FYI msBuildPath() already contains logic to prevent concatenating two
absolute paths. There is also a msBuildPath3() function that takes 3
path components and combines them, so I believe you should be able to do
this:
char path_buffer[MS_MAXPATHLEN];
msBuildPath3(path_buffer, map_path, shape_path, data_filename);
Unless I'm mistaken, this call should do exactly what you proposed
above, i.e.
- if data_filename is an absolute path then map_path and shape_path
are ignored.
- if data_filename is relative then it is appended to shape_path
- if shape_path is absolute then map_path is ignored
- if shape_path is relative then it is appended to map_path.
- finally, if shape_path is null then it should be automatically
ignored and the result will be map_path appended to data_filename.
Oh, and if some error happens then the function returns NULL, otherwise
it will return a reference to path_buffer.
Julien, can you please confirm that this is the expected behavior?
Daniel
--
------------------------------------------------------------
Daniel Morissette morissette at dmsolutions.ca
DM Solutions Group http://www.dmsolutions.ca/
------------------------------------------------------------
_______________________________________________
Mapserver-dev mailing list
Mapserver-dev at lists.gis.umn.edu
http://lists.gis.umn.edu/mailman/listinfo/mapserver-dev
More information about the mapserver-dev
mailing list