doublecmd/fhardlink.pas
Alexander Koblov 0bd2510b53 ADD: Some code for log file implementation
UPD: Replace WriteLn by DebugLn in some places
2008-01-19 22:35:35 +00:00

77 lines
1.5 KiB
ObjectPascal

unit fHardLink;
interface
uses
LResources,
SysUtils, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, Buttons;
type
TfrmHardLink = class(TForm)
lblNew: TLabel;
lblDst: TLabel;
edtNew: TEdit;
edtDst: TEdit;
btnOK: TBitBtn;
btnCancel: TBitBtn;
procedure btnOKClick(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
procedure ShowHardLinkForm(const sNew, sDst:String);
implementation
uses
uLng, uGlobs, uLog, uShowMsg, uOSUtils;
procedure ShowHardLinkForm(const sNew, sDst:String);
begin
with TfrmHardLink.Create(Application) do
begin
try
edtDst.Text:=sDst;
edtNew.Text:=sNew;
ShowModal;
finally
Free;
end;
end;
end;
procedure TfrmHardLink.btnOKClick(Sender: TObject);
var
sSrc,sDst:String;
begin
inherited;
sSrc:=edtNew.Text;
sDst:=edtDst.Text;
if CreateHardLink(sSrc, sDst) then
begin
// write log
if (log_cp_mv_ln in gLogOptions) and (log_success in gLogOptions) then
logWrite(Format(rsMsgLogSuccess+rsMsgLogLink,[sSrc+' -> '+sDst]), lmtSuccess);
Close;
end
else
begin
// write log
if (log_cp_mv_ln in gLogOptions) and (log_errors in gLogOptions) then
logWrite(Format(rsMsgLogError+rsMsgLogLink,[sSrc+' -> '+sDst]), lmtError);
// Standart error modal dialog
MsgError(rsHardErrCreate);
end;
end;
initialization
{$I fhardlink.lrs}
end.