如题,如果是返回真,不是返回假.如:c:\\\d.txt这就要返回假,c:\d.txt则返回真,不论目录是否存在

解决方案 »

  1.   

    写个函数 根据格式来判断 \d.txt 这个格式 则返回真
      

  2.   

    //---------------------------------------------------------
    //TO DO :判断是否是目录
    //参数:目录路径
    //成功返回True 错误返回False
    function TFile.IsDir(IsDirPath:string):Boolean;
    var
    FileGetAttrValue:integer;
    begin
    {$IFDEF WIN32}
    Result:=DirectoryExists(IsDirPath);
    Exit;
    {$ENDIF}
    if FileGetAttrValue=16 then
      begin
      Result:=true;
      end
      else
      Begin
        Result:=False;
      end;end;
    //---------------------------------------------------------
      

  3.   

    用directoryExists(path)只是判断此路径是否在磁盘中存在,并不是判断字符串是否为正确的目录结构字符串。如:c:\\\aaa\\\ddd就是错的