[fpc-pascal] ExtractRelativePath() not always returning expected result

James Richters james at productionautomation.net
Thu Aug 24 13:30:55 CEST 2017


I’m trying to figure out ExtractRelativePath() and I’ve run the sample program found here:

https://www.freepascal.org/docs-html/rtl/sysutils/extractrelativepath.html

 

I get the following results from the sample (with a few test I threw in myself):

>From "/pp/src/compiler" to "/pp/bin/win32/ppc386" via "..\bin\win32\ppc386"    // Shouldn’t this be “..\..\bin\win32\ppc386” ?

>From "/pp/bin/win32/ppc386" to "/pp/src/compiler" via "..\..\src\compiler"           // Shouldn’t this be "..\..\..\src\compiler" ?

>From "e:/pp/bin/win32/ppc386" to "d:/pp/src/compiler" via "d:/pp/src/compiler" //Expected

>From "e:\pp\bin\win32\ppc386" to "d:\pp\src\compiler" via "d:\pp\src\compiler" //Expected

>From "C:\FPC\3.0.2" to "C:\FPC\3.0.2" via "3.0.2"                                                             // Shouldn’t this be “”  since we are already there?

>From "C:\FPC\3.0.2" to "C:\FPC\3.0.4rc1" via "3.0.4rc1"                                                  // Shouldn’t this be "..\3.0.4rc1"?

>From "Q:\" to "Q:\FPC\3.0.4rc1" via "FPC\3.0.4rc1"                                                          //Expected

 

Am I missing something here?

 

James

 

 

 

 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-pascal/attachments/20170824/0f679bc1/attachment.html>


More information about the fpc-pascal mailing list