Home  |  Delphi .net Home  |  System.IO.Directory  |  GetDirectoryRoot Method
GetDirectoryRoot  
Method  
Gets the Root Device or Folder for the specified Path string
Directory Class
System.IO NameSpace
CF1.  Function GetDirectoryRoot ( PathString : String; ) : String; Static;
CF : Methods with this mark are Compact Framework Compatible
Description
Gets the root drive or folder for the specified PathString.
Notes
Static methods are not methods of an object - they are simply class functions or procedures available at any time.
Microsoft MSDN Links
System.IO
System.IO.Directory
 
 
A simple example
program Project1;
{$APPTYPE CONSOLE}

uses
  System.IO;

var
  Path : String;

begin
  // Get the current folder
  Path := System.IO.Directory.GetCurrentDirectory;
  Console.WriteLine(Path);

  // Get the root of this folder
  Console.WriteLine(System.IO.Directory.GetDirectoryRoot(Path));

  Console.Readline;
end.
Show full unit code
  C:\Documents and Settings\Neil\My Documents\Borland Studio Projects
  C:\
 
 
Delphi Programming © Neil Moffatt All rights reserved.  |  Contact the author