I cannot get it to work:
"cd('D:\Temp'); absolutepath('..')"
replies 'D:\Temp' instead of 'D:\'. "absolutepath('..', 'D:\Temp')" does not help also. "absolutepath('..\Temp')" does not work also. The documentation suggests, that "absolutepath('C:\WINXP', cd)" replies 'C:\WINXP', but the function stops with an error: "The path D:\Temp\C:\WINXP\ or file D:\Temp\C:\WINXP does not exist". For the same reasons, I cannot obtain the absolute path for e.g. "C:\WINXP\..".
The only valid results can be obtained, if a (nested) subfolder of the specified basefolder oder current directory is wanted.
"absolutepath('.', 'D:\')" replies 'D:', which differs from the correct 'D:\'.
The documentation is almost very good (H1 line, author, list of changes, syntax and examples), but the 2nd example 'A:\MyProject' seems to be unsolvable by the function (of course with an adjusted path name).
The function is rather slow: It needs 2.5 sec to convert the names of 837 M-files. GetFullPath from the FEX needs 0.05 sec for the same task.
Although the function is buggy, slow and works with a very limited sort of input, I really like the clear, simple and complete documentation and rate it with 3 stars.
Thanks for the comments Jan. I completely departed from the original code I tried to patch from Jochen Lenz, and greatly simplified and sped the function per your suggestions. In my brief tests I find the new version is 10X faster (although still 5X slower than the mex file).
Dear Jonathan, Thanks for updating your submission. The program is much faster now!
I still cannot process the example from the help section:
absolutepath('A:\MyProject\', 'C:\local\');
I tried is as:
absolutepath('C:\WinXP', cd)
But get a java.io.IOException "bad syntax for file name".
I think it is necessary to mention in the help section, that the file or folder must exist. And the important 3rd input should be explained also.