[Delphi (Object Pascal)] Delphi判断文件夹(目录)是否存在,不存在就创建一个 →→→→→进入此内容的聊天室

来自 , 2020-05-03, 写在 Delphi (Object Pascal), 查看 150 次.
URL http://www.code666.cn/view/e261489a
  1. procedure TForm1.Button1Click(Sender: TObject);
  2. begin
  3.   if not FileExists(Edit1.Text) then
  4. //if not DirectoryExists(Edit1.Text) then 判断目录是否存在
  5.   try
  6.     begin
  7.       CreateDir(Edit1.Text);
  8.     //ForceDirectories(Edit1.Text);   创建目录
  9.     end;
  10.   finally
  11.     raise Exception.Create('Cannot Create '+Edit1.Text);
  12.   end;
  13.  
  14. end;
  15.  
  16.  
  17. //delphi/8998

回复 "Delphi判断文件夹(目录)是否存在,不存在就创建一个"

这儿你可以回复上面这条便签

captcha