[Mapserver-dev] msBuildPath etc...
Julien-Samuel Lacroix
lacroix at dmsolutions.ca
Tue Feb 4 09:51:12 EST 2003
You're perfectly right Daniel. I think the msBuildPath3 will do exactly
what you want, Steve.
Julien
Daniel Morissette wrote:
> 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
--
------------------------------------------------------------
Julien-Samuel Lacroix lacroix at dmsolutions.ca
DM Solutions Group http://www.dmsolutions.ca/
------------------------------------------------------------
More information about the mapserver-dev
mailing list