之前複雜的ExtractFilePath 這類的函數總算有新的替換者了。
//較常用的方法:
TPath.GetTempPath; {擷取臨時檔案夾路徑}
TPath.GetTempFileName; {擷取一個臨時檔案名稱}
TPath.GetPathRoot(); {提取盤符, 如: c:/}
TPath.GetDirectoryName(); {提取路徑}
TPath.GetFileName(); {提取檔案名稱}
TPath.GetExtension(); {提取副檔名}
TPath.GetFileNameWithoutExtension(); {提取無副檔名的檔案名稱}
TPath.ChangeExtension(); {更換副檔名}
TPath.DriveExists(); {檢查路徑中的磁碟機是否存在}
TPath.GetFullPath(); {根據相對路徑給出全路徑}
TPath.HasExtension(); {判斷是否有副檔名}
TPath.IsPathRooted(); {判斷是否是絕對路徑}
TPath.Combine(); {結合路徑}
TPath.GetRandomFileName; {產生一個隨機檔案名稱}
TPath.GetGUIDFileName(); {用於產生一個唯一的檔案名稱, 布爾參數決定名稱中是否包含 -}
TPath.IsValidPathChar(); {判斷給定的字元是否能用於路徑名}
TPath.IsValidFileNameChar(); {判斷給定的字元是否能用於檔案名稱}
//不常用的方法
TPath.HasValidPathChars();
TPath.HasValidFileNameChars();
TPath.GetExtendedPrefix();
TPath.IsExtendedPrefixed();
TPath.IsUNCRooted();
TPath.IsDriveRooted();
TPath.IsUNCPath();
TPath.MatchesPattern();
TPath.GetInvalidFileNameChars;
TPath.GetInvalidPathChars;
TPath.GetAttributes();
TPath.SetAttributes();
//屬性, 擷取在不同平台下的各種路徑分隔字元, 都是唯讀.
TPath.AltDirectorySeparatorChar; {Windows 下是 "/"}
TPath.AltDirectorySeparatorChar; {Windows 下是 "/"}
TPath.ExtensionSeparatorChar; {Windows 下是 "."}
TPath.PathSeparator; {Windows 下是 ";"}
TPath.VolumeSeparatorChar; {Windows 下是 ":"}