Re: [Lazarus] CreateRelativePath document error.

2010-02-10 Thread Mattias Gaertner
On Tue, 9 Feb 2010 23:05:31 +0200 Juha Manninen juha.manni...@phnet.fi wrote: [...] 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). The ideprocs version is an alias to function in

Re: [Lazarus] CreateRelativePath document error.

2010-02-09 Thread Juha Manninen
Another thing related to CreateRelativePath: RelPath:=CreateRelativePath(FileName, BasePath); Now, when BasePath is '/TopDir/Tests/MyProj/' and FileName is '/TopDir/Tests/MyProj/src/MyUnit.pas' then RelPath = 'src/MyUnit.pas' which is correct. However if the BasePath is longer (deeper)

Re: [Lazarus] CreateRelativePath document error.

2010-02-09 Thread Paul van Helden
Hi Juha, 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). I use the following

Re: [Lazarus] CreateRelativePath document error.

2010-02-09 Thread Graeme Geldenhuys
Paul van Helden wrote: I use the following code (comes from Delphi but with some changes). The second function is to expand a relative path. NOTE: Please do not consider submitting this to FPC or Lazarus. We do not what the whole copyright issue again in FPC source code. Regards, -

Re: [Lazarus] CreateRelativePath document error.

2010-02-09 Thread Graeme Geldenhuys
Sorry, I only realized now what CreateRelativePath() does. My sample code simply trims a long path for visual display - that is NOT the function or CreateRelativePath(). Sorry about the confusion. Regards, - Graeme - -- fpGUI Toolkit - a cross-platform GUI toolkit using Free Pascal

Re: [Lazarus] CreateRelativePath document error.

2010-02-09 Thread Paul van Helden
On 2010/02/09 01:36 PM, Juha Manninen wrote: ExtractRelativePath seems to work well, thanks. Now, damn, it seems that FileUtil.CreateRelativePath works correctly, too. I was testing it in Lazarus Converter code and it used a version in lazarus/ide/ideprogs/ instead of FileUtil, even though

Re: [Lazarus] CreateRelativePath document error.

2010-02-09 Thread Graeme Geldenhuys
Juha Manninen wrote: 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. The last unit in the uses list (which has same signature function) takes precedence, not the first unit in uses

Re: [Lazarus] CreateRelativePath document error.

2010-02-09 Thread Graeme Geldenhuys
Paul van Helden wrote: Good. What is the recommended function for the inverse process? Doing a quick search, I would imagine one of the following: - ExpandFileName() - ExpandUNCFileName() - ExpandFileNameUTF8() - CleanAndExpandFilename() - ExpandUNCFileNameUTF8() -

Re: [Lazarus] CreateRelativePath document error.

2010-02-09 Thread Mattias Gärtner
Zitat von Juha Manninen juha.manni...@phnet.fi: 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

Re: [Lazarus] CreateRelativePath document error.

2010-02-09 Thread Mattias Gärtner
Zitat von Paul van Helden p...@planetgis.co.za: On 2010/02/09 01:36 PM, Juha Manninen wrote: ExtractRelativePath seems to work well, thanks. Now, damn, it seems that FileUtil.CreateRelativePath works correctly, too. I was testing it in Lazarus Converter code and it used a version in

Re: [Lazarus] CreateRelativePath document error.

2010-02-09 Thread Paul van Helden
On 2010/02/09 02:48 PM, Mattias Gärtner wrote: Zitat von Paul van Helden p...@planetgis.co.za: Good. What is the recommended function for the inverse process? I don't know for the ExtractRelativePath, but for CreateRelativePath it is simple:

Re: [Lazarus] CreateRelativePath document error.

2010-02-09 Thread Michael Van Canneyt
On Tue, 9 Feb 2010, Paul van Helden wrote: On 2010/02/09 02:48 PM, Mattias Gärtner wrote: Zitat von Paul van Helden p...@planetgis.co.za: Good. What is the recommended function for the inverse process? I don't know for the ExtractRelativePath, but for CreateRelativePath it is simple:

Re: [Lazarus] CreateRelativePath document error.

2010-02-09 Thread Graeme Geldenhuys
Michael Van Canneyt wrote: 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. Thank-you, that

Re: [Lazarus] CreateRelativePath document error.

2010-02-09 Thread Paul van Helden
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() -

Re: [Lazarus] CreateRelativePath document error.

2010-02-09 Thread Marco van de Voort
On Tue, Feb 09, 2010 at 03:41:38PM +0200, Paul van Helden wrote: 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

Re: [Lazarus] CreateRelativePath document error.

2010-02-09 Thread Mattias Gärtner
Zitat von Michael Van Canneyt mich...@freepascal.org: On Tue, 9 Feb 2010, Paul van Helden wrote: On 2010/02/09 02:48 PM, Mattias Gärtner wrote: Zitat von Paul van Helden p...@planetgis.co.za: Good. What is the recommended function for the inverse process? I don't know for the

Re: [Lazarus] CreateRelativePath document error.

2010-02-09 Thread Michael Van Canneyt
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() -

Re: [Lazarus] CreateRelativePath document error.

2010-02-09 Thread Michael Van Canneyt
On Tue, 9 Feb 2010, Marco van de Voort wrote: On Tue, Feb 09, 2010 at 03:41:38PM +0200, Paul van Helden wrote: 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

Re: [Lazarus] CreateRelativePath document error.

2010-02-09 Thread Paul van Helden
On 2010/02/09 04:20 PM, Mattias Gärtner wrote: ExpandFileName does exactly that. No. ExpandFilename does much more and less. It corrects \ and / to path delim, expands a relative filename with the *current working directory* (Get/SetCurrentDir) and it expands tilde '~' to $HOME under

Re: [Lazarus] CreateRelativePath document error.

2010-02-09 Thread Mattias Gärtner
Zitat von Paul van Helden p...@planetgis.co.za: On 2010/02/09 04:20 PM, Mattias Gärtner wrote: ExpandFileName does exactly that. No. ExpandFilename does much more and less. It corrects \ and / to path delim, expands a relative filename with the *current working directory*

Re: [Lazarus] CreateRelativePath document error.

2010-02-09 Thread Juha Manninen
Mattias Gärtner wrote: Now, damn, it seems that FileUtil.CreateRelativePath works correctly, too. :)It is used at a lot of places in the IDE. Yes, I don't know what happened. Now all those functions seem to work correctly. The ideprocs version is a simple alias. I will delete it. The

[Lazarus] CreateRelativePath document error.

2010-02-07 Thread Juha Manninen
Hi, On page: http://lazarus-ccr.sourceforge.net/docs/lcl/fileutil/createrelativepath.html Function Result section says: The file name expressed as path relative to the current directory It should be ... path relative to BaseDirectory The same error is in Description section, too. Maybe there