Autor Beitrag
Andre :-)
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 55



BeitragVerfasst: So 26.01.03 21:01 
Hi,

also ich frage jetzt mal vorsicht eine Frage zum Thema FTP an. Und zwar mache ich ein nlist. Aber wenn ich jetzt ein DirChange mache, und der Ordner keine Inhalte hat, dann bekomm eich eine FTP EXCEPTION mit 550 not found. Ich habe es auch mit einem try Block versucht, aber nichts zu machen.

Hier mal mein Code, der relavant sein müsste. (Ich setze immer am Anfang einen festen Ordner um das Dir wieder nach oben zu wechseln). Und ich habe "noch" null Plan von Exceptions in Delphi. Danke Euch jetzt schon!
ausblenden Quelltext
1:
2:
3:
4:
5:
6:
7:
// Dieses wird beim Change aufgerufen
procedure TForm3.ListFiles;
begin
Q := 1;
lstRemote.Items.Clear;
try NMFTP1.Nlist;    except end;
end;


ausblenden volle Höhe Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
procedure TForm3.NMFTP1ListItem(Listing: String);
var
   NewItem: TListItem;
   sFile: String;
   Dir : String;
begin
    if(Q = 1) then
    begin
        NewItem := lstRemote.Items.Add;
        NewItem.Caption  := '..';
        NewItem.ImageIndex := 8;
        Inc(Q);
    end;

    try
    NewItem := lstRemote.Items.Add;
    sFile := Listing;
    NewItem.Caption  := sFile;
        if ExtractFileExt(sFile) = '.txt' then NewItem.ImageIndex := 0
         else if (ExtractFileExt(sFile) = '.htm') OR (ExtractFileExt(sFile) = '.html') then
           NewItem.ImageIndex := 1
         else if ExtractFileExt(sFile) = '.zip' then NewItem.ImageIndex := 3
         else if ExtractFileExt(sFile) = '.css' then newItem.imageIndex := 2
         else if (ExtractFileExt(sFile) = '.gif') OR (ExtractFileExt(sFile) = '.jpg') then
           NewItem.ImageIndex := 4
         else if ExtractFileExt(sFile) = '' then
         begin
           NewItem.ImageIndex := 5;
         end

         else if ExtractFileExt(sFile) = '.exe' then newItem.imageIndex := 7
         else NewItem.ImageIndex := 6;
         Inc(Q);
    except end;
end;

_________________
Security is just a feeling, but never reality
Andre :-) Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 55



BeitragVerfasst: So 26.01.03 23:20 
ICH IDIOT! :autsch:

ausblenden Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
procedure TForm3.ListFiles;
var NewItem: TListItem;
begin
Q := 1;
lstRemote.Items.Clear;
try NMFTP1.Nlist;  except on E: FTPException do
    begin
    NewItem := lstRemote.Items.Add;
    NewItem.Caption  := '..';
    NewItem.ImageIndex := 8;
    end;
end;
end;


Also nun geht das! Zwar spuckt der Debugger im Delphi noch einen Fehler auf, aber das macht er laut Hilfe nur, weil ich es so eingestellt habe. Ausserhalb macht er was ich will.

Dennoch danke
Andre :-)

_________________
Security is just a feeling, but never reality