Description |
The IsPathRooted method returns true if the path in the specified PathString is absolute, or false if it is relative to the current directory position.
|
|
Microsoft MSDN Links |
System.IO
System.IO.Path
|
|
|
A simple example |
program Project1;
{$APPTYPE CONSOLE}
uses
System.IO;
var
PathString : String;
begin
PathString := 'C:\DelphiBasics.txt';
if System.IO.Path.IsPathRooted(PathString)
then Console.WriteLine('"{0}" has an absolute path',
PathString)
else Console.WriteLine('"{0}" has a relative path',
PathString);
PathString := 'DelphiBasics.txt';
if System.IO.Path.IsPathRooted(PathString)
then Console.WriteLine('"{0}" has an absolute path',
PathString)
else Console.WriteLine('"{0}" has a relative path',
PathString);
Console.Readline;
end.
| Show full unit code | "C:\DelphiBasics.txt" has an absolute path
"DelphiBasics.txt" has a relative path
|
|
|
|