path:=extractfilepath(application.exename);
path:=path+'data\';
  if DirectoryExists(path)=false then
    ForceDirectories(path);

解决方案 »

  1.   

    uses FileCtrl;procedure TForm1.Button1Click(Sender: TObject);
    begin
      if not DirectoryExists('c:\temp') then
        if not CreateDir('C:\temp') then
        raise Exception.Create('Cannot create c:\temp');
    end;enjoy it:)
      

  2.   

      ForceDirectories(c:\aaa);
      

  3.   

    var 
    a:string;
    ..
    CreatDir(a);
    ...
      

  4.   

    ForceDirectories 最好了,不管3721....
      

  5.   

    ForceDirectories('E:\Temp');
    别忘了在单元的Uses里面加上FileCtrl
      

  6.   

    同意: Crob(我干嘛这么帅) 
      

  7.   

    谁能说说ForceDirectories和CreatDir的区别啊?