Page 1 of 1

InitError

Posted: Thu 06 Jun 2019 13:33
by mbillig02
I am trying to return an error with text that I want and it does not appear to be working. Can I return text like below through InitError?

{========================================================================}
procedure TMainForm.ScSFTPServerMakeDirectory(Sender: TObject;
SFTPSessionInfo: TScSFTPSessionInfo; const Path: string;
var Error: TScSFTPError);
begin
// InfoMemo.Lines.Append(SFTPSessionInfo.Client.UserExtData);
if Pos('C',SFTPSessionInfo.Client.UserExtData) > 0 then
begin
ScSFTPServer.DefaultMakeDirectory(SFTPSessionInfo,Path,Error);
end
else
begin
InitError(Error, erPermissionDenied, '550 Can''t create directory. Permission denied');
end;
end;
{========================================================================}

Re: InitError

Posted: Thu 06 Jun 2019 14:13
by ViktorV
You can use the code you provided to solve your task.
Note that to run this code, you should add the ScSFTPConsts unit to the USES clause of your unit.