Re: [twsocket] FTP Server Virtual Directory Example

2010-10-24 Thread Angus Robertson - Magenta Systems Ltd
> I have not done a lot of overriding.  Using the FtpServer demo 
> program can
> you point me in the right direction for doing the overload?

Looking at my code again, I see my overridden BuildDirList function is
actually commented out, it must have been my first attempt at adding
virtual directory listing.  

Instead there is new OnAddVirtFiles method that allows extra virtual
files to be added to the dynamic File Records array. 

Angus

--
To unsubscribe or change your settings for TWSocket mailing list
please goto http://lists.elists.org/cgi-bin/mailman/listinfo/twsocket
Visit our website at http://www.overbyte.be


Re: [twsocket] FTP Server Virtual Directory Example

2010-10-24 Thread Mark Billig
Angus, thank you for your help.

 

I have not done a lot of overriding.  Using the FtpServer demo program can
you point me in the right direction for doing the overload?

 

Thanks,

Mark

--
To unsubscribe or change your settings for TWSocket mailing list
please goto http://lists.elists.org/cgi-bin/mailman/listinfo/twsocket
Visit our website at http://www.overbyte.be


Re: [twsocket] FTP Server Virtual Directory Example

2010-10-23 Thread Angus Robertson - Magenta Systems Ltd
> Does someone have an example in Delphi of the use of virtual 
> directories using the FtpServer component 

I have two arrays with the virtual and physical names:
VDirs: WideStringArray ;
PDirs: WideStringArray ;

which is filled with real paths:
VDir1=d:\websites\logfiles
PDir1=d:\logs

so if the root is websites and the path logfiles, it changes to d:\logs.
Then in event FtpServerAlterDirectory, translate the paths both ways: 

if ClientSoc.TotVirDir = 0 then exit ;
for I := 0 to ClientSoc.TotVirDir - 1 do
begin
if (FileName <> '?') then 
// ? is used in FormatResponsePath to get original path
begin
 // translate virtual to phyiscal directory
   if Pos (ClientSoc.VDirs [I], Directory) = 1 then
   begin
   NewFileName := ClientSoc.PDirs [I] + Copy (Directory,
Length (ClientSoc.VDirs [I]) + 1, 999) + FileName ;
   exit ;
   end;
end
else
begin
// translate physical to virtual directory
   if (Pos (ClientSoc.PDirs [I], Directory) = 1) then
   begin
  NewFileName := ClientSoc.VDirs [I] + Copy (Directory,
Length (ClientSoc.PDirs [I]) + 1, 999) ;
  exit ;
   end;
end;
 end;

You also need to override BuildDirList to check for virtual directories
at root level and build a virtual directory listing from the correct
physical path, but that's too much code for this list.  

Angus

--
To unsubscribe or change your settings for TWSocket mailing list
please goto http://lists.elists.org/cgi-bin/mailman/listinfo/twsocket
Visit our website at http://www.overbyte.be