全國最多中醫師線上諮詢網站-台灣中醫網
發文 回覆 瀏覽次數:659
推到 Plurk!
推到 Facebook!

如何找Path 的問題

尚未結案
Dark852
一般會員


發表:14
回覆:19
積分:6
註冊:2004-09-25

發送簡訊給我
#1 引用回覆 回覆 發表時間:2005-04-18 13:01:49 IP:210.6.xxx.xxx 未訂閱
請問如果 detect 到那條path 是否存在呢 如 defaultPath := C:/Program Files/Test/Test.ini IF defaultPath Not Find defaultPath := D:/Program Files/Test/Test.ini 以上的語法怎麼用 Delphi 寫出來 謝謝
speedup
資深會員


發表:19
回覆:259
積分:280
註冊:2003-07-04

發送簡訊給我
#2 引用回覆 回覆 發表時間:2005-04-18 13:28:50 IP:220.135.xxx.xxx 未訂閱
引言: 請問如果 detect 到那條path 是否存在呢 如 defaultPath := C:/Program Files/Test/Test.ini IF defaultPath Not Find defaultPath := D:/Program Files/Test/Test.ini
看你的需求應該用FileExist
  defaultPath := 'C:/Program Files/Test/Test.ini';      IF Not FileExists(defaultPath) then
    defaultPath := D:/Program Files/Test/Test.ini;
至於偵測路徑在不在的指令是DirectoryExists
 
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;
混心雜欲 棄修身~唉
------
唉~
系統時間:2024-05-21 10:34:29
聯絡我們 | Delphi K.Top討論版
本站聲明
1. 本論壇為無營利行為之開放平台,所有文章都是由網友自行張貼,如牽涉到法律糾紛一切與本站無關。
2. 假如網友發表之內容涉及侵權,而損及您的利益,請立即通知版主刪除。
3. 請勿批評中華民國元首及政府或批評各政黨,是藍是綠本站無權干涉,但這裡不是政治性論壇!