Mono Class Library: System.IO.Path Overview | Members

System.IO.Path.GetFullPath Method

Returns information required to uniquely identify a file within a file system. [Edit]

public static string GetFullPath (string path)

Parameters

path
A string containing the file or directory for which to obtain absolute path information. [Edit]

Returns

A string containing the fully qualified (absolute) location of path . [Edit]

Permissions

TypeReason
System.Security.Permissions.FileIOPermission [Edit] Requires permission to access path information. See System.Security.Permissions.FileIOPermissionAccess.PathDiscovery .

Exceptions

TypeReason
ArgumentException

path is a zero-length string, contains only white space, or contains one or more implementation-specific invalid characters.

-or-

The system could not retrieve the absolute path.

[Edit]
System.Security.SecurityExceptionThe caller does not have the required permissions. [Edit]
ArgumentNullExceptionpath is null . [Edit]
System.IO.PathTooLongExceptionThe length of path or the absolute path information for path exceeds the system-defined maximum length. [Edit]

Remarks

The absolute path includes all information required to locate a file or directory on a system. The file or directory specified by path is not required to exist; however if path does exist, the caller is required to have permission to obtain path information for path. Note that unlike most members of the System.IO.Path class, this method accesses the file system. [Edit]

Example

The following example demonstrates the Path.GetFullPath(string) method on a Windows system. In this example, the absolute path for the current directory is c:\ecmatest\examples.

C# Example
using System; 
using System.IO; 
class GetDirectoryTest { 
 public static void Main() { 
   string [] paths = { 
     @"\ecmatest\examples\pathtests.txt", 
     @"\ecmatest\examples\", 
     "pathtests.xyzzy", 
     @"\", 
   }; 
   foreach (string pathString in paths) 
     Console.WriteLine("Path: {0} full path is {1}",pathString, 

Path.GetFullPath(pathString));
 } 
}

The output is

Path: \ecmatest\examples\pathtests.txt full path is C:\ecmatest\examples\pathtests.txt
Path: \ecmatest\examples\ full path is C:\ecmatest\examples\
Path: pathtests.xyzzy full path is C:\ecmatest\examples\pathtests.xyzzy
Path: \ full path is C:\

Requirements

Namespace: System.IO
Assembly: mscorlib (in mscorlib.dll)
Assembly Versions: 1.0.5000.0, 2.0.0.0