MCPcopy Index your code
hub / github.com/MapServer/MapServer / msGetPath

Function msGetPath

mapstring.c:621–648  ·  view source on GitHub ↗

** Returns the *path* portion of the filename fn. Memory is allocated using malloc. */

Source from the content-addressed store, hash-verified

619** Returns the *path* portion of the filename fn. Memory is allocated using malloc.
620*/
621char *msGetPath(char *fn)
622{
623 char *str;
624 int i, length;
625
626 length = strlen(fn);
627 if((str = msStrdup(fn)) == NULL)
628 return(NULL);
629
630 for(i=length-1; i>=0; i--) { /* step backwards through the string */
631 if((str[i] == '/') || (str[i] == '\\')) {
632 str[i+1] = '\0';
633 break;
634 }
635 }
636
637 if(strcmp(str, fn) == 0)
638 {
639 msFree(str);
640#if defined(_WIN32) && !defined(__CYGWIN__)
641 str = msStrdup(".\\");
642#else
643 str= msStrdup("./");
644#endif
645 }
646
647 return(str);
648}
649
650/*
651** Returns a *path* built from abs_path and path.

Callers 6

msTileIndexAbsoluteDirFunction · 0.85
msRasterQueryByRectFunction · 0.85
mapfile.cFile · 0.85
msLoadFontSetFunction · 0.85
loadSymbolSetFunction · 0.85
msDrawRasterLayerLowFunction · 0.85

Calls 2

msStrdupFunction · 0.85
msFreeFunction · 0.85

Tested by

no test coverage detected