[Lazarus] CreateRelativePath document error.
Michael Van Canneyt
michael at freepascal.org
Tue Feb 9 15:25:19 CET 2010
On Tue, 9 Feb 2010, Paul van Helden wrote:
>
> On 2010/02/09 03:20 PM, Michael Van Canneyt wrote:
>>> I'm talking specifically about /relative/ paths, ie. ones with ../../../
>>> in them.
>>>
>>> On 2010/02/09 02:02 PM, Graeme Geldenhuys wrote:
>>>> - ExpandFileName()
>>>> - ExpandUNCFileName()
>>>> - ExpandFileNameUTF8()
>>>> - CleanAndExpandFilename()
>>>> - ExpandUNCFileNameUTF8()
>>>> - CleanAndExpandDirectory()
>>>>
>>>>
>>> Graeme: you also missed this. None of those functions take a base path and
>>> applies a relative path to produce a new absolute path. The function must
>>> be able to go up some directories and then down some others.
>>
>>
>> ExpandFileName does exactly that.
>>
>>
> No it doesn't, unless you're assuming your current directory as the base
> path. ExtractRelativePath specifically takes a base path as a parameter. Its
> inverse should do the same. In a GUI app (at least mine) I don't care about
> my current directory.
Yes it does ?
ExpandFileName(BasePath+RelativePath);
Will get rid of all '..' pairs and do what you need. Obviously, BasePath
must be an absolute pathname; But the same holds for ExtractRelativePath.
Michael.
More information about the Lazarus
mailing list