IOUtils的tpath

TPath = record
     //判断字符是否可用于路径
     function IsValidPathChar(const AChar: Char): Boolean;  
    //字符是否可用于文件名
     function IsValidFileNameChar(const AChar: Char): Boolean;  
    //
     function HasValidPathChars(const Path: string; const UseWildcards: Boolean): Boolean; 
    //
     function HasValidFileNameChars(const FileName: string;const UseWildcards: Boolean): Boolean; 
   //
     function GetExtendedPrefix(const Path: string): TPathPrefixType; 
     function IsDriveRooted(const Path: string): Boolean; 
     function IsExtendedPrefixed(const Path: string): Boolean;  
     function IsRelativePath(const Path: string): Boolean; 
     function IsUNCPath(const Path: string): Boolean;  
     function IsUNCRooted(const Path: string): Boolean; 
     function GetGUIDFileName(const UseSeparator: Boolean = False): string; 
    //盘符存在
     function DriveExists(const Path: string): Boolean; 
     function MatchesPattern(const FileName, Pattern: string;
        const CaseSensitive: Boolean): Boolean; 
    //修改扩展名,返回的是字符串,并不进行实际的修改
     function ChangeExtension(const Path, Extension: string): string; 
    //组合路径,如果路径1是空,则返回路径2;如果路径2为空,则返回路径1;如果路径2含目录,返回路径2;如果路径2只是文件名,则返回路径1+路径2
     function Combine(const Path1, Path2: string): string;  
    //获取文件的目录
     function GetDirectoryName(FileName: string): string; 
    //获取文件的扩展名,扩展名含字符“.”。例如“.exe”
     function GetExtension(const FileName: string): string; 
    //获取文件名
     function GetFileName(const FileName: string): string;  
    //获取文件名,但不包含扩展名
     function GetFileNameWithoutExtension(const FileName: string): string; 
    //获取某一路径的详细路径名,例如“…”表示上面三层目录,此函数给出目录的具体名称
     function GetFullPath(const Path: string): string; 
    //给出所有可用于文件名的字符
     function GetInvalidFileNameChars: TCharArray;  
    //给出所有可用于路径的字符集
     function GetInvalidPathChars: TCharArray;  
    //给出路径的根目录,例如“C:/”、“D:/”
     function GetPathRoot(const Path: string): string; 
    //生成一个随机的文件名,不含路径
     function GetRandomFileName: string; 
    //获取临时文件文件名,扩展名是“.tmp”
     function GetTempFileName: string; 
    //获取临时文件夹路径
     function GetTempPath: string; 
    //获取home的路径,一般是C:UsersAdministratorAppDataRoaming
     function GetHomePath: string; 
    //获取“我的文档”的路径,接下来的若干函数用于获得各种特殊库的路径
     function GetDocumentsPath: string; 
//获取共享文档的路径
     Function GetSharedDocumentsPath: string; 
    //获取库的路径
     function GetLibraryPath: string; 
     function GetCachePath: string; 
     function GetPublicPath: string; 
     function GetPicturesPath: string; 
     function GetSharedPicturesPath: string; 
     function GetCameraPath: string; 
     function GetSharedCameraPath: string; 
     function GetMusicPath: string; 
     function GetSharedMusicPath: string; 
     function GetMoviesPath: string; 
     function GetSharedMoviesPath: string; 
     function GetAlarmsPath: string; 
     function GetSharedAlarmsPath: string; 
     function GetDownloadsPath: string; 
     function GetSharedDownloadsPath: string; 
     function GetRingtonesPath: string; 
     function GetSharedRingtonesPath: string; 

    //获得路径的属性
     function GetAttributes(const Path: string; FollowLink: Boolean = True): TFileAttributes;  
     procedure SetAttributes(const Path: string; const Attributes: TFileAttributes);  
//判断是否有扩展名
     function HasExtension(const Path: string): Boolean; 
    //是否是根目录
     function IsPathRooted(const Path: string): Boolean;  

    //扩展名的间隔符,windows下是“.”
     property ExtensionSeparatorChar: Char read FExtensionSeparatorChar;
    //备用的目录分隔符,“/”
     property AltDirectorySeparatorChar: Char read FAltDirectorySeparatorChar;
    //目录分隔符,windows下是“”
     property DirectorySeparatorChar: Char read FDirectorySeparatorChar;
    //路径之间的分隔符,windows下是“;”
     property PathSeparator: Char read FPathSeparator;
    //盘符间隔字符,windows下是“:”
     property VolumeSeparatorChar: Char read FVolumeSeparatorChar;
  end;

 Tpath主要是path方面的功能,直接就可以使用。

可以参考其他人的关于tpath的介绍。

https://www.cnblogs.com/hnxxcxg/archive/2013/03/03/2941335.html

原文地址:https://www.cnblogs.com/luohq001/p/13055946.html