Path.IsPathFullyQualified 메서드

정의

파일 경로가 정규화되었는지 여부를 나타내는 값을 반환합니다.

오버로드

IsPathFullyQualified(ReadOnlySpan<Char>)

지정된 문자 범위로 표시되는 파일 경로가 특정 드라이브 또는 UNC 경로에 고정되었는지 여부를 나타내는 값을 반환합니다.

IsPathFullyQualified(String)

지정된 파일 경로가 특정 드라이브 또는 UNC 경로에 고정되었는지 여부를 나타내는 값을 반환합니다.

설명

AltDirectorySeparatorChar 문자를 모두 사용하는 메서드 핸들 경로의 IsPathFullyQualifiedDirectorySeparatorChar 오버로드입니다. 인수로 전달되는 경로에 대한 유효성 검사를 수행하지 않습니다. 결과적으로 URI는 상대 경로로 해석되고 를 반환 false합니다.

정규화된 경로(메서드에서 나타낸 IsPathFullyQualified 대로)와 루트 경로(메서드에서 나타낸 IsPathRooted 대로)는 차이가 있습니다. 정규화된 경로 또는 절대 경로는 항상 특정 드라이브 또는 디바이스에서 대상 파일 또는 디렉터리로의 정확한 경로를 정의하며 현재 드라이브 또는 현재 디렉터리에 의존하지 않습니다. 예를 들어 Windows 시스템에서 C:/users/user1/documents/reports/2019/january/highlights.pdf C: 드라이브의 루트에서 대상 파일로의 절대 경로를 정의하고 highlights.pdf. 루트 경로는 시작 드라이브 또는 루트 디렉터리를 지정하지만 현재 디렉터리(지정된 드라이브에 의해 루팅된 경우) 또는 현재 드라이브(루트 디렉터리에 의해 루팅된 경우)에 따라 달라집니다. 다음 예제에서는 정규화된 경로와 루트 경로 간의 차이점을 보여 줍니다.

using System;
using System.IO;

class Program
{
    static void Main()
    {
        string relative1 = "C:Documents"; 
        ShowPathInfo(relative1);

        string relative2 = "/Documents";
        ShowPathInfo(relative2);

        string absolute = "C:/Documents";
        ShowPathInfo(absolute);
    }

    private static void ShowPathInfo(string path)
    {
        Console.WriteLine($"Path: {path}");
        Console.WriteLine($"   Rooted: {Path.IsPathRooted(path)}");
        Console.WriteLine($"   Fully qualified: {Path.IsPathFullyQualified(path)}");
        Console.WriteLine($"   Full path: {Path.GetFullPath(path)}");
        Console.WriteLine();
    }
}
// The example displays the following output when run on a Windows system:
//    Path: C:Documents
//        Rooted: True
//        Fully qualified: False
//        Full path: c:\Users\user1\Documents\projects\path\ispathrooted\Documents
//
//    Path: /Documents
//       Rooted: True
//       Fully qualified: False
//       Full path: c:\Documents
//
//    Path: C:/Documents
//       Rooted: True
//       Fully qualified: True
//       Full path: C:\Documents
Imports System.IO

Module Program
    Public Sub Main()
        Dim relative1 As String = "C:Documents" 
        ShowPathInfo(relative1)

        Dim relative2 As String = "C:Documents" 
        ShowPathInfo(relative2)

        Dim absolute As String = "C:/Documents"
        ShowPathInfo(absolute)
    End Sub

    Private Sub ShowPathInfo(filepath As String)
        Console.WriteLine($"Path: {filepath}")
        Console.WriteLine($"   Rooted: {Path.IsPathRooted(filepath)}")
        Console.WriteLine($"   Fully qualified: {Path.IsPathFullyQualified(filepath)}")
        Console.WriteLine($"   Full path: {Path.GetFullPath(filepath)}")
        Console.WriteLine()
    End Sub
End Module
' The example displays the following output when run on a Windows system:
'    Path: C:Documents
'        Rooted: True
'        Fully qualified: False
'        Full path: c:\Users\user1\Documents\projects\path\ispathrooted\Documents
'
'    Path: /Documents
'       Rooted: True
'       Fully qualified: False
'       Full path: c:\Documents
'
'    Path: C:/Documents
'       Rooted: True
'       Fully qualified: True
'       Full path: C:\Documents

IsPathFullyQualified(ReadOnlySpan<Char>)

Source:
Path.cs
Source:
Path.cs
Source:
Path.cs

지정된 문자 범위로 표시되는 파일 경로가 특정 드라이브 또는 UNC 경로에 고정되었는지 여부를 나타내는 값을 반환합니다.

public:
 static bool IsPathFullyQualified(ReadOnlySpan<char> path);
public static bool IsPathFullyQualified (ReadOnlySpan<char> path);
static member IsPathFullyQualified : ReadOnlySpan<char> -> bool
Public Shared Function IsPathFullyQualified (path As ReadOnlySpan(Of Char)) As Boolean

매개 변수

path
ReadOnlySpan<Char>

파일 경로입니다.

반환

경로가 특정 드라이브 또는 UNC 경로에 고정된 경우 true이고, 경로가 현재 드라이브 또는 작업 디렉터리에 상대적인 경우 false입니다.

추가 정보

적용 대상

IsPathFullyQualified(String)

Source:
Path.cs
Source:
Path.cs
Source:
Path.cs

지정된 파일 경로가 특정 드라이브 또는 UNC 경로에 고정되었는지 여부를 나타내는 값을 반환합니다.

public:
 static bool IsPathFullyQualified(System::String ^ path);
public static bool IsPathFullyQualified (string path);
static member IsPathFullyQualified : string -> bool
Public Shared Function IsPathFullyQualified (path As String) As Boolean

매개 변수

path
String

파일 경로입니다.

반환

경로가 특정 드라이브 또는 UNC 경로에 고정된 경우 true이고, 경로가 현재 드라이브 또는 작업 디렉터리에 상대적인 경우 false입니다.

예외

pathnull입니다.

설명

이 메서드는 대체 디렉터리 구분 기호를 사용하는 경로를 처리합니다. 루트 경로(IsPathRooted(String))가 상대적이 아니라고 가정하는 것은 빈번한 실수입니다. 예를 들어 "C:a"는 드라이브 상대입니다. 즉, C: (루트가 있지만 상대)에 대한 현재 디렉터리에 대해 확인됩니다. "C:\a"는 루트이며 상대 디렉터리가 아닙니다. 즉, 현재 디렉터리가 경로를 수정하는 데 사용되지 않습니다.

추가 정보

적용 대상