我以前修改过,很简单的,不过忘了修改什么地方了。
{* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *}
//add by zhong wan 2004-1-5
function TFtpServer.BuildListBuf(Client: TFtpCtrlSocket;
Detailed: Boolean): string;
var
F: TSearchRec;
Path: string;
Status: Integer;
Buf: string;
begin
DecodeDate(Now, ThisYear, ThisMonth, ThisDay);
Path := Client.Directory;
if Path[Length(Path)] = '/' then
Path := Path + '*.*';
Status := FindFirst(Path, faAnyFile, F);
while Status = 0 do
begin
if Detailed then
Buf := Buf + FormatUnixDirEntry(F) + #13#10
else
Buf := Buf + F.Name + #13#10;
Status := FindNext(F);
end;
FindClose(F);
if Length(Buf) = 0 then
begin
Buf := Path + ' not found' + #13#10;
end else
begin
Result := Buf;
end;
end;
你重点看看他的代码的ChangeDir部分
if Allowed then
Answer := Format(msgCWDSuccess,
[BackSlashesToSlashes(Client.Directory)])
就是Answer返回去掉前面的路经就是。