help files
Z505 | PasWiki | FUQ | Search | Main Docs | API Guide



[Overview][Constants][Types][Classes][Procedures and functions][Variables] Reference for unit 'sysutils' (#rtl)

ExtractRelativepath

Extract a relative path from a filename, given a base directory.

Declaration

Source position: finah.inc line 35

function ExtractRelativepath(

  const BaseName: String;

  const DestNAme: String

):String;

Description

ExtractRelativePath constructs a relative path to go from BaseName to DestName . If DestName is on another drive (Not on Linux) then the whole Destname is returned. Note: This function does not exist in the Delphi unit.

Errors

None.

See also

ExtractFileName

  

Extract the filename part from a full path filename.

ExtractFilePath

  

Extract the path from a filename.

ExtractFileDir

  

Extract the drive and directory part of a filename.

ExtractFileDrive

  

Extract the drive part from a filename.

ExtractFileExt

  

Return the extension from a filename.

Example

Program Example35;

{ This program demonstrates the ExtractRelativePath function }

Uses sysutils;

Procedure Testit (FromDir,ToDir : String);

begin
  Write ('From "',FromDir,'" to "',ToDir,'" via "');
  Writeln (ExtractRelativePath(FromDir,ToDir),'"');
end;

Begin
 Testit ('/pp/src/compiler','/pp/bin/win32/ppc386');
 Testit ('/pp/bin/win32/ppc386','/pp/src/compiler');
 Testit ('e:/pp/bin/win32/ppc386','d:/pp/src/compiler');
 Testit ('e:\pp\bin\win32\ppc386','d:\pp\src\compiler');
End.

Notes

 No notes exist for this page yet. 





lufdoc, Powtils, fpc, freepascal, delphi, kylix, c/c++, mysql, cgi web framework docs, Z505