Zitat von Juha Manninen <[email protected]>:
Hi!
FPC RTL comes with ExtractRelativePath. I still use my own code because
Delphi's didn't work properly either. It seems FPC's ExtractRelativePath
is much shorter than mine. If someone can confirm it works well that
would be great (no time now to test thoroughly).
ExtractRelativePath seems to work well, thanks.
Now, damn, it seems that FileUtil.CreateRelativePath works correctly, too.
:)
It is used at a lot of places in the IDE.
I was testing it in Lazarus Converter code and it used a version in
lazarus/ide/ideprogs/ instead of FileUtil, even though FileUtil is higher in
"uses" list.
Both CreateRelativePath functions are the same.
And 'higher' in uses list means more to the end (right, down).
I think there is some redundant and useless code in Lazarus, but it is
understandable in such a big project.
The ideprocs version is a simple alias. I will delete it.
The codetools and lcl are separate and independent things (by license
and by directory).
So, these 2 work identically in my tests and you should be able to use them,
too:
RelPath:=FileUtil.CreateRelativePath(PasFile, ABasePath);
RelPath:=ExtractRelativePath(ABasePath, PasFile);
No.
ExtractRelativePath works case insensitive, even under Linux.
CreateRelativePath expects trimmed filenames. That means no double
slashes '//'. I will change it, so that it also works with untrimmed
filenames.
Mattias
--
_______________________________________________
Lazarus mailing list
[email protected]
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus