getrelativefilename returns incorrect value in case of same beginning of directory names
Reported by Markus
BUG DESCRIPTION:
----------------
The function 'getrelativefilename' seems to have a bug, if a directory in the directory chain of 'abs_file' begins with the same name than one in the 'abs_dir' chain.
Example:
abs_dir = 'C:\scilab\bin'
abs_file = 'C:\scilabX\modules\helptools\readme.txt'
ERROR LOG:
----------
No error but incorrect return value.
HOW TO REPRODUCE THE BUG:
-------------------------
getrelativefilename('C:\scilab\bin', 'C:\scilabX\modules\helptools\readme.txt')
The function incorrectly returns:
"..\scilabX\modules\helptools\readme.txt"
The correct relative path shall be:
"..\..\scilabX\modules\helptools\readme.txt"
OTHER INFORMATION:
------------------
Change the upper example (a little bit) to:
getrelativefilename('C:\scilab\bin', 'C:\Xscilab\modules\helptools\readme.txt')
Returns the correct value:
"..\..\Xscilab\modules\helptools\readme.txt"