TDirectory.IsRelativePath是否相对路径

使用函数:

  System.IOUtils.TDirectory.IsRelativePath

class function IsRelativePath(const Path: string): Boolean; inline; static;

异常处理:无,纯粹判断路径,与目录是否存在无关

代码:

begin
    // 判断指定目录是否为相对路径
    try
        if (TDirectory.IsRelativePath(Trim(Edit1.Text))) then
            ShowMessage(Edit1.Text + '是相对路径')
        else
            ShowMessage(Edit1.Text + '不是相对路径');
    except
        on e: Exception do
        begin
            MessageDlg(e.ClassName + ' : ' + e.Message, mtError, [mbok], 0);
            Exit;
        end;
    end;
end;

posted @ 2014-01-02 14:53  oszhouzhb  阅读(198)  评论(0编辑  收藏  举报