finished publish project

git-svn-id: trunk@3711 -
This commit is contained in:
mattias 2002-12-17 19:49:34 +00:00
parent ba2d299a91
commit afec99cd51
6 changed files with 450 additions and 152 deletions

View File

@ -37,7 +37,7 @@ unit ProjectDefs;
interface
uses
Classes, SysUtils, Laz_XMLCfg, IDEProcs;
Classes, SysUtils, Laz_XMLCfg, IDEProcs, SynRegExpr, FileProcs;
type
TOnLoadSaveFilename = procedure(var Filename:string; Load:boolean) of object;
@ -249,7 +249,14 @@ type
FCommandAfter: string;
FDestinationDirectory: string;
FExcludeFileFilter: string;
FExcludeFilterRegExpr: TRegExpr;
FExcludeFilterSimpleSyntax: boolean;
FExcludeFilterValid: boolean;
FIgnoreBinaries: boolean;
FIncludeFileFilter: string;
FIncludeFilterRegExpr: TRegExpr;
FIncludeFilterSimpleSyntax: boolean;
FIncludeFilterValid: boolean;
FSaveClosedEditorFilesInfo: boolean;
FSaveEditorInfoOfNonProjectFiles: boolean;
FUseExcludeFileFilter: boolean;
@ -257,11 +264,16 @@ type
procedure SetCommandAfter(const AValue: string);
procedure SetDestinationDirectory(const AValue: string);
procedure SetExcludeFileFilter(const AValue: string);
procedure SetExcludeFilterSimpleSyntax(const AValue: boolean);
procedure SetIgnoreBinaries(const AValue: boolean);
procedure SetIncludeFileFilter(const AValue: string);
procedure SetIncludeFilterSimpleSyntax(const AValue: boolean);
procedure SetSaveClosedEditorFilesInfo(const AValue: boolean);
procedure SetSaveEditorInfoOfNonProjectFiles(const AValue: boolean);
procedure SetUseExcludeFileFilter(const AValue: boolean);
procedure SetUseIncludeFileFilter(const AValue: boolean);
procedure UpdateIncludeFilter;
procedure UpdateExcludeFilter;
public
constructor Create;
destructor Destroy; override;
@ -271,22 +283,30 @@ type
procedure SaveToXMLConfig(XMLConfig: TXMLConfig; const APath: string);
function FileCanBePublished(const AFilename: string): boolean;
function WriteFlags: TProjectWriteFlags;
public
// destination
property DestinationDirectory: string
read FDestinationDirectory write SetDestinationDirectory;
property CommandAfter: string read FCommandAfter write SetCommandAfter;
// file filter
property IgnoreBinaries: boolean read FIgnoreBinaries write SetIgnoreBinaries;
property UseIncludeFileFilter: boolean
read FUseIncludeFileFilter write SetUseIncludeFileFilter;
property IncludeFilterSimpleSyntax: boolean
read FIncludeFilterSimpleSyntax write SetIncludeFilterSimpleSyntax;
property IncludeFileFilter: string
read FIncludeFileFilter write SetIncludeFileFilter;
property IncludeFilterValid: boolean read FIncludeFilterValid;
property UseExcludeFileFilter: boolean
read FUseExcludeFileFilter write SetUseExcludeFileFilter;
property ExcludeFilterSimpleSyntax: boolean
read FExcludeFilterSimpleSyntax write SetExcludeFilterSimpleSyntax;
property ExcludeFileFilter: string
read FExcludeFileFilter write SetExcludeFileFilter;
property ExcludeFilterValid: boolean read FExcludeFilterValid;
// project info
property SaveEditorInfoOfNonProjectFiles: boolean
read FSaveEditorInfoOfNonProjectFiles
@ -299,6 +319,11 @@ type
//---------------------------------------------------------------------------
const
PublishProjectOptsVersion = 2;
DefPublProjIncFilter = '*.(pas|pp|inc|lfm|lpr|lrs|lpi|lpk|sh|xml)';
DefPublProjExcFilter = '*.(bak|ppu|ppw|o|so);*~;backup';
function ProjectWatchTypeNameToType(const s: string): TProjectWatchType;
@ -961,12 +986,36 @@ procedure TPublishProjectOptions.SetExcludeFileFilter(const AValue: string);
begin
if FExcludeFileFilter=AValue then exit;
FExcludeFileFilter:=AValue;
UpdateExcludeFilter;
end;
procedure TPublishProjectOptions.SetExcludeFilterSimpleSyntax(
const AValue: boolean);
begin
if FExcludeFilterSimpleSyntax=AValue then exit;
FExcludeFilterSimpleSyntax:=AValue;
UpdateExcludeFilter;
end;
procedure TPublishProjectOptions.SetIgnoreBinaries(const AValue: boolean);
begin
if FIgnoreBinaries=AValue then exit;
FIgnoreBinaries:=AValue;
end;
procedure TPublishProjectOptions.SetIncludeFileFilter(const AValue: string);
begin
if FIncludeFileFilter=AValue then exit;
FIncludeFileFilter:=AValue;
UpdateIncludeFilter;
end;
procedure TPublishProjectOptions.SetIncludeFilterSimpleSyntax(
const AValue: boolean);
begin
if FIncludeFilterSimpleSyntax=AValue then exit;
FIncludeFilterSimpleSyntax:=AValue;
UpdateIncludeFilter;
end;
procedure TPublishProjectOptions.SetSaveClosedEditorFilesInfo(
@ -997,6 +1046,48 @@ begin
FUseIncludeFileFilter:=AValue;
end;
procedure TPublishProjectOptions.UpdateIncludeFilter;
var
Expr: string;
begin
if FIncludeFilterRegExpr=nil then
FIncludeFilterRegExpr:=TRegExpr.Create;
if IncludeFilterSimpleSyntax then
Expr:=SimpleSyntaxToRegExpr(FIncludeFileFilter)
else
Expr:=FIncludeFileFilter;
try
FIncludeFilterRegExpr.Expression:=Expr;
FIncludeFilterValid:=true;
except
on E: Exception do begin
writeln('Invalid Include File Expression ',Expr,' ',E.Message);
FIncludeFilterValid:=false;
end;
end;
end;
procedure TPublishProjectOptions.UpdateExcludeFilter;
var
Expr: string;
begin
if FExcludeFilterRegExpr=nil then
FExcludeFilterRegExpr:=TRegExpr.Create;
if ExcludeFilterSimpleSyntax then
Expr:=SimpleSyntaxToRegExpr(FExcludeFileFilter)
else
Expr:=FExcludeFileFilter;
try
FExcludeFilterRegExpr.Expression:=Expr;
FExcludeFilterValid:=true;
except
on E: Exception do begin
writeln('Invalid Exclude File Expression ',Expr,' ',E.Message);
FExcludeFilterValid:=false;
end;
end;
end;
constructor TPublishProjectOptions.Create;
begin
LoadDefaults;
@ -1005,6 +1096,8 @@ end;
destructor TPublishProjectOptions.Destroy;
begin
Clear;
FIncludeFilterRegExpr.Free;
FExcludeFilterRegExpr.Free;
inherited Destroy;
end;
@ -1017,29 +1110,42 @@ procedure TPublishProjectOptions.LoadDefaults;
begin
FDestinationDirectory:='$(TestDir)/publishedproject/';
FCommandAfter:='';
FUseIncludeFileFilter:=true;
FIncludeFileFilter:='*.{pas,pp,inc,lfm,lpr,lrs,lpi,lpk,fpc,sh,xml}';
FUseExcludeFileFilter:=false;
FExcludeFileFilter:='*.{bak,ppu,ppw,o,so};*~;backup';
UseIncludeFileFilter:=true;
IncludeFilterSimpleSyntax:=true;
IncludeFileFilter:=DefPublProjIncFilter;
UseExcludeFileFilter:=false;
ExcludeFilterSimpleSyntax:=true;
ExcludeFileFilter:=DefPublProjExcFilter;
FSaveClosedEditorFilesInfo:=false;
FSaveEditorInfoOfNonProjectFiles:=false;
end;
procedure TPublishProjectOptions.LoadFromXMLConfig(XMLConfig: TXMLConfig;
const APath: string);
var
XMLVersion: integer;
begin
LoadDefaults;
XMLVersion:=XMLConfig.GetValue(APath+'Version/Value',0);
FDestinationDirectory:=XMLConfig.GetValue(APath+'DestinationDirectory/Value',
DestinationDirectory);
FCommandAfter:=XMLConfig.GetValue(APath+'CommandAfter/Value',CommandAfter);
FUseIncludeFileFilter:=XMLConfig.GetValue(APath+'UseIncludeFileFilter/Value',
UseIncludeFileFilter:=XMLConfig.GetValue(APath+'UseIncludeFileFilter/Value',
UseIncludeFileFilter);
FIncludeFileFilter:=XMLConfig.GetValue(APath+'IncludeFileFilter/Value',
IncludeFileFilter);
FUseExcludeFileFilter:=XMLConfig.GetValue(APath+'UseExcludeFileFilter/Value',
IncludeFilterSimpleSyntax:=
XMLConfig.GetValue(APath+'IncludeFilterSimpleSyntax/Value',
IncludeFilterSimpleSyntax);
if XMLVersion>=2 then
IncludeFileFilter:=XMLConfig.GetValue(APath+'IncludeFileFilter/Value',
IncludeFileFilter);
UseExcludeFileFilter:=XMLConfig.GetValue(APath+'UseExcludeFileFilter/Value',
UseExcludeFileFilter);
FExcludeFileFilter:=XMLConfig.GetValue(APath+'ExcludeFileFilter/Value',
ExcludeFileFilter);
ExcludeFilterSimpleSyntax:=
XMLConfig.GetValue(APath+'ExcludeFilterSimpleSyntax/Value',
ExcludeFilterSimpleSyntax);
if XMLVersion>=2 then
ExcludeFileFilter:=XMLConfig.GetValue(APath+'ExcludeFileFilter/Value',
ExcludeFileFilter);
FSaveClosedEditorFilesInfo:=XMLConfig.GetValue(
APath+'SaveClosedEditorFilesInfo/Value',SaveClosedEditorFilesInfo);
FSaveEditorInfoOfNonProjectFiles:=XMLConfig.GetValue(
@ -1050,11 +1156,14 @@ end;
procedure TPublishProjectOptions.SaveToXMLConfig(XMLConfig: TXMLConfig;
const APath: string);
begin
XMLConfig.SetValue(APath+'Version/Value',PublishProjectOptsVersion);
XMLConfig.SetValue(APath+'DestinationDirectory/Value',DestinationDirectory);
XMLConfig.SetValue(APath+'CommandAfter/Value',CommandAfter);
XMLConfig.SetValue(APath+'UseIncludeFileFilter/Value',UseIncludeFileFilter);
XMLConfig.SetValue(APath+'IncludeFilterSimpleSyntax/Value',IncludeFilterSimpleSyntax);
XMLConfig.SetValue(APath+'IncludeFileFilter/Value',IncludeFileFilter);
XMLConfig.SetValue(APath+'UseExcludeFileFilter/Value',UseExcludeFileFilter);
XMLConfig.SetValue(APath+'ExcludeFilterSimpleSyntax/Value',ExcludeFilterSimpleSyntax);
XMLConfig.SetValue(APath+'ExcludeFileFilter/Value',ExcludeFileFilter);
XMLConfig.SetValue(APath+'SaveClosedEditorFilesInfo/Value',
SaveClosedEditorFilesInfo);
@ -1065,19 +1174,23 @@ end;
function TPublishProjectOptions.FileCanBePublished(
const AFilename: string): boolean;
begin
{Result:=false;
Result:=false;
// check include filter
if UseIncludeFileFilter
and not FilenameIsMatching(IncludeFileFilter,ExtractFilename(AFilename),true)
then
and (FIncludeFilterRegExpr<>nil)
and (not FIncludeFilterRegExpr.Exec(ExtractFilename(AFilename))) then
exit;
// check exclude filter
if UseExcludeFileFilter
and FilenameIsMatching(ExcludeFileFilter,ExtractFilename(AFilename),true)
then
exit;}
and (FExcludeFilterRegExpr<>nil)
and (FExcludeFilterRegExpr.Exec(ExtractFilename(AFilename))) then
exit;
// check binaries
if IgnoreBinaries and (not FileIsText(AFilename)) then exit;
Result:=true;
end;

View File

@ -1,12 +1,13 @@
object PublishProjectDialog: TPublishProjectDialog
CAPTION = 'Publish Project'
COLOR = -2147483633
CLIENTHEIGHT = 403
CLIENTHEIGHT = 462
CLIENTWIDTH = 469
POSITION = poscreencenter
ONRESIZE = PublishProjectDialogRESIZE
HORZSCROLLBAR.PAGE = 470
VERTSCROLLBAR.PAGE = 463
LEFT = 343
HEIGHT = 403
HEIGHT = 462
TOP = 289
WIDTH = 469
object OkButton: TBUTTON
@ -15,9 +16,9 @@ object PublishProjectDialog: TPublishProjectDialog
CAPTION = 'Ok'
TABSTOP = True
ONCLICK = OkButtonCLICK
LEFT = 76
LEFT = 72
HEIGHT = 25
TOP = 368
TOP = 432
WIDTH = 75
end
object CancelButton: TBUTTON
@ -26,9 +27,9 @@ object PublishProjectDialog: TPublishProjectDialog
CAPTION = 'Cancel'
TABSTOP = True
TABORDER = 1
LEFT = 375
LEFT = 371
HEIGHT = 25
TOP = 368
TOP = 432
WIDTH = 75
end
object DestDirGroupBox: TGROUPBOX
@ -44,6 +45,7 @@ object PublishProjectDialog: TPublishProjectDialog
WIDTH = 450
object DestDirComboBox: TCOMBOBOX
ANCHORS = [aktop, akleft]
MAXLENGTH = 0
PARENTCTL3D = False
TABSTOP = True
TEXT = 'DestDirComboBox'
@ -69,6 +71,7 @@ object PublishProjectDialog: TPublishProjectDialog
end
object CommandAfterCombobox: TCOMBOBOX
ANCHORS = [aktop, akleft]
MAXLENGTH = 0
PARENTCTL3D = False
TABORDER = 2
TABSTOP = True
@ -97,57 +100,21 @@ object PublishProjectDialog: TPublishProjectDialog
TABORDER = 3
ONRESIZE = FilesGroupboxRESIZE
LEFT = 8
HEIGHT = 139
HEIGHT = 44
TOP = 128
WIDTH = 450
object UseIncludeFilterCheckbox: TCHECKBOX
object IgnoreBinariesCheckbox: TCHECKBOX
AUTOSIZE = True
ALLOWGRAYED = True
ANCHORS = [aktop, akleft]
CAPTION = 'Use include filter'
CAPTION = 'Ignore binaries'
DRAGCURSOR = 0
TABSTOP = True
TABSTOP = True
LEFT = 4
LEFT = 6
HEIGHT = 20
WIDTH = 171
end
object IncludeFileFilterCombobox: TCOMBOBOX
ANCHORS = [aktop, akleft]
PARENTCTL3D = False
TABORDER = 1
TABSTOP = True
TEXT = 'IncludeFileFilterCombobox'
LEFT = 4
HEIGHT = 25
TOP = 24
WIDTH = 432
end
object UseExcludeFilterCheckbox: TCHECKBOX
AUTOSIZE = True
ALLOWGRAYED = True
ANCHORS = [aktop, akleft]
CAPTION = 'Use exclude filter'
DRAGCURSOR = 0
TABORDER = 2
TABSTOP = True
TABORDER = 2
TABSTOP = True
LEFT = 4
HEIGHT = 20
TOP = 64
WIDTH = 175
end
object ExcludeFileFilterCombobox: TCOMBOBOX
ANCHORS = [aktop, akleft]
PARENTCTL3D = False
TABORDER = 3
TABSTOP = True
TEXT = 'ExcludeFileFilterCombobox'
LEFT = 4
HEIGHT = 25
TOP = 88
WIDTH = 432
TOP = 1
WIDTH = 161
end
end
object ProjectInfoGroupbox: TGROUPBOX
@ -159,7 +126,7 @@ object PublishProjectDialog: TPublishProjectDialog
ONRESIZE = ProjectInfoGroupboxRESIZE
LEFT = 8
HEIGHT = 69
TOP = 280
TOP = 344
WIDTH = 450
object SaveClosedEditorFilesInfoCheckbox: TCHECKBOX
AUTOSIZE = True
@ -196,9 +163,115 @@ object PublishProjectDialog: TPublishProjectDialog
TABSTOP = True
TABORDER = 5
ONCLICK = SaveSettingsButtonCLICK
LEFT = 202
LEFT = 198
HEIGHT = 25
TOP = 368
TOP = 432
WIDTH = 120
end
object IncludeFilterGroupbox: TGROUPBOX
ANCHORS = [aktop, akleft]
CAPTION = 'Include Filter'
COLOR = -2147483643
PARENTCTL3D = False
TABORDER = 6
TABSTOP = True
ONRESIZE = IncludeFilterGroupboxRESIZE
LEFT = 8
HEIGHT = 75
TOP = 176
WIDTH = 450
object UseIncludeFilterCheckbox: TCHECKBOX
AUTOSIZE = True
ALLOWGRAYED = True
ANCHORS = [aktop, akleft]
CAPTION = 'Use Include Filter'
DRAGCURSOR = 0
TABSTOP = True
TABSTOP = True
LEFT = 6
HEIGHT = 20
TOP = 1
WIDTH = 171
end
object IncFilterSimpleSyntaxCheckbox: TCHECKBOX
AUTOSIZE = True
ALLOWGRAYED = True
ANCHORS = [aktop, akleft]
CAPTION = 'Simple Syntax'
DRAGCURSOR = 0
TABORDER = 1
TABSTOP = True
TABORDER = 1
TABSTOP = True
LEFT = 196
HEIGHT = 20
TOP = 2
WIDTH = 201
end
object IncludeFilterCombobox: TCOMBOBOX
ANCHORS = [aktop, akleft]
MAXLENGTH = 0
PARENTCTL3D = False
TABORDER = 2
TABSTOP = True
TEXT = 'IncludeFilterCombobox'
LEFT = 6
HEIGHT = 25
TOP = 25
WIDTH = 430
end
end
object ExcludeFilterGroupbox: TGROUPBOX
ANCHORS = [aktop, akleft]
CAPTION = 'Exclude Filter'
COLOR = -2147483643
PARENTCTL3D = False
TABORDER = 7
TABSTOP = True
ONRESIZE = ExcludeFilterGroupboxRESIZE
LEFT = 8
HEIGHT = 79
TOP = 256
WIDTH = 448
object UseExcludeFilterCheckbox: TCHECKBOX
AUTOSIZE = True
ALLOWGRAYED = True
ANCHORS = [aktop, akleft]
CAPTION = 'Use Exclude Filter'
DRAGCURSOR = 0
TABSTOP = True
TABSTOP = True
LEFT = 6
HEIGHT = 20
TOP = 5
WIDTH = 151
end
object ExcFilterSimpleSyntaxCheckbox: TCHECKBOX
AUTOSIZE = True
ALLOWGRAYED = True
ANCHORS = [aktop, akleft]
CAPTION = 'Simple Syntax'
DRAGCURSOR = 0
TABORDER = 1
TABSTOP = True
TABORDER = 1
TABSTOP = True
LEFT = 199
HEIGHT = 20
TOP = 6
WIDTH = 212
end
object ExcludeFilterCombobox: TCOMBOBOX
ANCHORS = [aktop, akleft]
MAXLENGTH = 0
PARENTCTL3D = False
TABORDER = 2
TABSTOP = True
TEXT = 'ExcludeFilterCombobox'
LEFT = 6
HEIGHT = 25
TOP = 30
WIDTH = 430
end
end
end

View File

@ -2,59 +2,78 @@
LazarusResources.Add('TPublishProjectDialog','FORMDATA',[
'TPF0'#21'TPublishProjectDialog'#20'PublishProjectDialog'#7'CAPTION'#6#15'Pub'
+'lish Project'#5'COLOR'#4#15#0#0#128#12'CLIENTHEIGHT'#3#147#1#11'CLIENTWIDTH'
+#3#213#1#8'POSITION'#7#14'poscreencenter'#8'ONRESIZE'#7#26'PublishProjectDia'
+'logRESIZE'#4'LEFT'#3'W'#1#6'HEIGHT'#3#147#1#3'TOP'#3'!'#1#5'WIDTH'#3#213#1#0
+#7'TBUTTON'#8'OkButton'#7'ANCHORS'#11#5'aktop'#7'akright'#0#11'MODALRESULT'#2
+#1#7'CAPTION'#6#2'Ok'#7'TABSTOP'#9#7'ONCLICK'#7#13'OkButtonCLICK'#4'LEFT'#2
+'L'#6'HEIGHT'#2#25#3'TOP'#3'p'#1#5'WIDTH'#2'K'#0#0#7'TBUTTON'#12'CancelButto'
+'n'#7'ANCHORS'#11#5'aktop'#7'akright'#0#11'MODALRESULT'#2#2#7'CAPTION'#6#6'C'
+'ancel'#7'TABSTOP'#9#8'TABORDER'#2#1#4'LEFT'#3'w'#1#6'HEIGHT'#2#25#3'TOP'#3
+'p'#1#5'WIDTH'#2'K'#0#0#9'TGROUPBOX'#15'DestDirGroupBox'#7'ANCHORS'#11#5'akt'
+'op'#6'akleft'#0#7'CAPTION'#6#21'Destination directory'#5'COLOR'#4#5#0#0#128
+#11'PARENTCTL3D'#8#8'TABORDER'#2#2#8'ONRESIZE'#7#21'DestDirGroupBoxRESIZE'#4
+'LEFT'#2#8#6'HEIGHT'#2'o'#3'TOP'#2#8#5'WIDTH'#3#194#1#0#9'TCOMBOBOX'#15'Dest'
+'DirComboBox'#7'ANCHORS'#11#5'aktop'#6'akleft'#0#11'PARENTCTL3D'#8#7'TABSTOP'
+#9#4'TEXT'#6#15'DestDirComboBox'#4'LEFT'#2#6#6'HEIGHT'#2#25#3'TOP'#2#1#5'WID'
+'TH'#3'^'#1#0#0#7'TBITBTN'#19'BrowseDestDirBitBtn'#10'GLYPH.Data'#10'>'#0#0#0
+':'#0#0#0'BM:'#0#0#0#0#0#0#0'6'#0#0#0'('#0#0#0#1#0#0#0#1#0#0#0#1#0#16#0#0#0#0
+#0#4#0#0#0'Z'#0#0#0'`'#0#0#0'@'#0#0#0'@'#0#0#0#0#0#0#0#7'SPACING'#2#3#7'ANCH'
+'ORS'#11#5'aktop'#6'akleft'#0#7'CAPTION'#6#6'Browse'#7'TABSTOP'#9#8'TABORDER'
+#2#1#4'LEFT'#3'n'#1#6'HEIGHT'#2#25#3'TOP'#2#1#5'WIDTH'#2'H'#0#0#9'TCOMBOBOX'
+#20'CommandAfterCombobox'#7'ANCHORS'#11#5'aktop'#6'akleft'#0#11'PARENTCTL3D'
+#8#8'TABORDER'#2#2#7'TABSTOP'#9#4'TEXT'#6#20'CommandAfterCombobox'#4'LEFT'#2
+#6#6'HEIGHT'#2#25#3'TOP'#2':'#5'WIDTH'#3#174#1#0#0#6'TLABEL'#17'CommandAfter'
+'Label'#7'ANCHORS'#11#5'aktop'#6'akleft'#0#7'CAPTION'#6#14'Command after:'#5
+'COLOR'#4#5#0#0#128#6'LAYOUT'#7#5'tltop'#4'LEFT'#2#6#6'HEIGHT'#2#17#3'TOP'#2
+'lish Project'#12'CLIENTHEIGHT'#3#206#1#11'CLIENTWIDTH'#3#213#1#8'POSITION'#7
+#14'poscreencenter'#8'ONRESIZE'#7#26'PublishProjectDialogRESIZE'#18'HORZSCRO'
+'LLBAR.PAGE'#3#214#1#18'VERTSCROLLBAR.PAGE'#3#207#1#4'LEFT'#3'W'#1#6'HEIGHT'
+#3#206#1#3'TOP'#3'!'#1#5'WIDTH'#3#213#1#0#7'TBUTTON'#8'OkButton'#7'ANCHORS'
+#11#5'aktop'#7'akright'#0#11'MODALRESULT'#2#1#7'CAPTION'#6#2'Ok'#7'TABSTOP'#9
+#7'ONCLICK'#7#13'OkButtonCLICK'#4'LEFT'#2'H'#6'HEIGHT'#2#25#3'TOP'#3#176#1#5
+'WIDTH'#2'K'#0#0#7'TBUTTON'#12'CancelButton'#7'ANCHORS'#11#5'aktop'#7'akrigh'
+'t'#0#11'MODALRESULT'#2#2#7'CAPTION'#6#6'Cancel'#7'TABSTOP'#9#8'TABORDER'#2#1
+#4'LEFT'#3's'#1#6'HEIGHT'#2#25#3'TOP'#3#176#1#5'WIDTH'#2'K'#0#0#9'TGROUPBOX'
+#15'DestDirGroupBox'#7'ANCHORS'#11#5'aktop'#6'akleft'#0#7'CAPTION'#6#21'Dest'
+'ination directory'#5'COLOR'#4#5#0#0#128#11'PARENTCTL3D'#8#8'TABORDER'#2#2#8
+'ONRESIZE'#7#21'DestDirGroupBoxRESIZE'#4'LEFT'#2#8#6'HEIGHT'#2'o'#3'TOP'#2#8
+#5'WIDTH'#3#194#1#0#9'TCOMBOBOX'#15'DestDirComboBox'#7'ANCHORS'#11#5'aktop'#6
+'akleft'#0#9'MAXLENGTH'#2#0#11'PARENTCTL3D'#8#7'TABSTOP'#9#4'TEXT'#6#15'Dest'
+'DirComboBox'#4'LEFT'#2#6#6'HEIGHT'#2#25#3'TOP'#2#1#5'WIDTH'#3'^'#1#0#0#7'TB'
+'ITBTN'#19'BrowseDestDirBitBtn'#10'GLYPH.Data'#10'>'#0#0#0':'#0#0#0'BM:'#0#0
+#0#0#0#0#0'6'#0#0#0'('#0#0#0#1#0#0#0#1#0#0#0#1#0#16#0#0#0#0#0#4#0#0#0'Z'#0#0
+#0'`'#0#0#0'@'#0#0#0'@'#0#0#0#0#0#0#0#7'SPACING'#2#3#7'ANCHORS'#11#5'aktop'#6
+'akleft'#0#7'CAPTION'#6#6'Browse'#7'TABSTOP'#9#8'TABORDER'#2#1#4'LEFT'#3'n'#1
+#6'HEIGHT'#2#25#3'TOP'#2#1#5'WIDTH'#2'H'#0#0#9'TCOMBOBOX'#20'CommandAfterCom'
+'bobox'#7'ANCHORS'#11#5'aktop'#6'akleft'#0#9'MAXLENGTH'#2#0#11'PARENTCTL3D'#8
+#8'TABORDER'#2#2#7'TABSTOP'#9#4'TEXT'#6#20'CommandAfterCombobox'#4'LEFT'#2#6
+#6'HEIGHT'#2#25#3'TOP'#2':'#5'WIDTH'#3#174#1#0#0#6'TLABEL'#17'CommandAfterLa'
+'bel'#7'ANCHORS'#11#5'aktop'#6'akleft'#0#7'CAPTION'#6#14'Command after:'#5'C'
+'OLOR'#4#5#0#0#128#6'LAYOUT'#7#5'tltop'#4'LEFT'#2#6#6'HEIGHT'#2#17#3'TOP'#2
+'!'#5'WIDTH'#3#172#1#0#0#0#9'TGROUPBOX'#13'FilesGroupbox'#7'ANCHORS'#11#5'ak'
+'top'#6'akleft'#0#7'CAPTION'#6#5'Files'#5'COLOR'#4#5#0#0#128#11'PARENTCTL3D'
+#8#8'TABORDER'#2#3#8'ONRESIZE'#7#19'FilesGroupboxRESIZE'#4'LEFT'#2#8#6'HEIGH'
+'T'#3#139#0#3'TOP'#3#128#0#5'WIDTH'#3#194#1#0#9'TCHECKBOX'#24'UseIncludeFilt'
+'erCheckbox'#8'AUTOSIZE'#9#11'ALLOWGRAYED'#9#7'ANCHORS'#11#5'aktop'#6'akleft'
+#0#7'CAPTION'#6#18'Use include filter'#10'DRAGCURSOR'#2#0#7'TABSTOP'#9#7'TAB'
+'STOP'#9#4'LEFT'#2#4#6'HEIGHT'#2#20#5'WIDTH'#3#171#0#0#0#9'TCOMBOBOX'#25'Inc'
+'ludeFileFilterCombobox'#7'ANCHORS'#11#5'aktop'#6'akleft'#0#11'PARENTCTL3D'#8
+#8'TABORDER'#2#1#7'TABSTOP'#9#4'TEXT'#6#25'IncludeFileFilterCombobox'#4'LEFT'
+#2#4#6'HEIGHT'#2#25#3'TOP'#2#24#5'WIDTH'#3#176#1#0#0#9'TCHECKBOX'#24'UseExcl'
+'udeFilterCheckbox'#8'AUTOSIZE'#9#11'ALLOWGRAYED'#9#7'ANCHORS'#11#5'aktop'#6
+'akleft'#0#7'CAPTION'#6#18'Use exclude filter'#10'DRAGCURSOR'#2#0#8'TABORDER'
+#2#2#7'TABSTOP'#9#8'TABORDER'#2#2#7'TABSTOP'#9#4'LEFT'#2#4#6'HEIGHT'#2#20#3
+'TOP'#2'@'#5'WIDTH'#3#175#0#0#0#9'TCOMBOBOX'#25'ExcludeFileFilterCombobox'#7
+'ANCHORS'#11#5'aktop'#6'akleft'#0#11'PARENTCTL3D'#8#8'TABORDER'#2#3#7'TABSTO'
+'P'#9#4'TEXT'#6#25'ExcludeFileFilterCombobox'#4'LEFT'#2#4#6'HEIGHT'#2#25#3'T'
+'OP'#2'X'#5'WIDTH'#3#176#1#0#0#0#9'TGROUPBOX'#19'ProjectInfoGroupbox'#7'ANCH'
+'ORS'#11#5'aktop'#6'akleft'#0#7'CAPTION'#6#19'Project Information'#5'COLOR'#4
+#5#0#0#128#11'PARENTCTL3D'#8#8'TABORDER'#2#4#8'ONRESIZE'#7#25'ProjectInfoGro'
+'upboxRESIZE'#4'LEFT'#2#8#6'HEIGHT'#2'E'#3'TOP'#3#24#1#5'WIDTH'#3#194#1#0#9
+'TCHECKBOX!SaveClosedEditorFilesInfoCheckbox'#8'AUTOSIZE'#9#11'ALLOWGRAYED'#9
+#7'ANCHORS'#11#5'aktop'#6'akleft'#0#7'CAPTION'#6' Save editor info of closed'
+' files'#10'DRAGCURSOR'#2#0#7'TABSTOP'#9#7'TABSTOP'#9#4'LEFT'#2#4#6'HEIGHT'#2
+#20#3'TOP'#2#1#5'WIDTH'#3#176#1#0#0#9'TCHECKBOX''SaveEditorInfoOfNonProjectF'
+'ilesCheckbox'#8'AUTOSIZE'#9#11'ALLOWGRAYED'#9#7'ANCHORS'#11#5'aktop'#6'akle'
+'ft'#0#7'CAPTION'#6'%Save editor info of non project files'#10'DRAGCURSOR'#2
+#0#8'TABORDER'#2#1#7'TABSTOP'#9#8'TABORDER'#2#1#7'TABSTOP'#9#4'LEFT'#2#4#6'H'
+'EIGHT'#2#20#3'TOP'#2#26#5'WIDTH'#3#176#1#0#0#0#7'TBUTTON'#18'SaveSettingsBu'
+'tton'#7'ANCHORS'#11#5'aktop'#7'akright'#0#7'CAPTION'#6#13'Save settings'#7
+'TABSTOP'#9#8'TABORDER'#2#5#7'ONCLICK'#7#23'SaveSettingsButtonCLICK'#4'LEFT'
+#3#202#0#6'HEIGHT'#2#25#3'TOP'#3'p'#1#5'WIDTH'#2'x'#0#0#0
+'T'#2','#3'TOP'#3#128#0#5'WIDTH'#3#194#1#0#9'TCHECKBOX'#22'IgnoreBinariesChe'
+'ckbox'#8'AUTOSIZE'#9#11'ALLOWGRAYED'#9#7'ANCHORS'#11#5'aktop'#6'akleft'#0#7
+'CAPTION'#6#15'Ignore binaries'#10'DRAGCURSOR'#2#0#7'TABSTOP'#9#7'TABSTOP'#9
+#4'LEFT'#2#6#6'HEIGHT'#2#20#3'TOP'#2#1#5'WIDTH'#3#161#0#0#0#0#9'TGROUPBOX'#19
+'ProjectInfoGroupbox'#7'ANCHORS'#11#5'aktop'#6'akleft'#0#7'CAPTION'#6#19'Pro'
+'ject Information'#5'COLOR'#4#5#0#0#128#11'PARENTCTL3D'#8#8'TABORDER'#2#4#8
+'ONRESIZE'#7#25'ProjectInfoGroupboxRESIZE'#4'LEFT'#2#8#6'HEIGHT'#2'E'#3'TOP'
+#3'X'#1#5'WIDTH'#3#194#1#0#9'TCHECKBOX!SaveClosedEditorFilesInfoCheckbox'#8
+'AUTOSIZE'#9#11'ALLOWGRAYED'#9#7'ANCHORS'#11#5'aktop'#6'akleft'#0#7'CAPTION'
+#6' Save editor info of closed files'#10'DRAGCURSOR'#2#0#7'TABSTOP'#9#7'TABS'
+'TOP'#9#4'LEFT'#2#4#6'HEIGHT'#2#20#3'TOP'#2#1#5'WIDTH'#3#176#1#0#0#9'TCHECKB'
+'OX''SaveEditorInfoOfNonProjectFilesCheckbox'#8'AUTOSIZE'#9#11'ALLOWGRAYED'#9
+#7'ANCHORS'#11#5'aktop'#6'akleft'#0#7'CAPTION'#6'%Save editor info of non pr'
+'oject files'#10'DRAGCURSOR'#2#0#8'TABORDER'#2#1#7'TABSTOP'#9#8'TABORDER'#2#1
+#7'TABSTOP'#9#4'LEFT'#2#4#6'HEIGHT'#2#20#3'TOP'#2#26#5'WIDTH'#3#176#1#0#0#0#7
+'TBUTTON'#18'SaveSettingsButton'#7'ANCHORS'#11#5'aktop'#7'akright'#0#7'CAPTI'
+'ON'#6#13'Save settings'#7'TABSTOP'#9#8'TABORDER'#2#5#7'ONCLICK'#7#23'SaveSe'
+'ttingsButtonCLICK'#4'LEFT'#3#198#0#6'HEIGHT'#2#25#3'TOP'#3#176#1#5'WIDTH'#2
+'x'#0#0#9'TGROUPBOX'#21'IncludeFilterGroupbox'#7'ANCHORS'#11#5'aktop'#6'akle'
+'ft'#0#7'CAPTION'#6#14'Include Filter'#5'COLOR'#4#5#0#0#128#11'PARENTCTL3D'#8
+#8'TABORDER'#2#6#7'TABSTOP'#9#8'ONRESIZE'#7#27'IncludeFilterGroupboxRESIZE'#4
+'LEFT'#2#8#6'HEIGHT'#2'K'#3'TOP'#3#176#0#5'WIDTH'#3#194#1#0#9'TCHECKBOX'#24
+'UseIncludeFilterCheckbox'#8'AUTOSIZE'#9#11'ALLOWGRAYED'#9#7'ANCHORS'#11#5'a'
+'ktop'#6'akleft'#0#7'CAPTION'#6#18'Use Include Filter'#10'DRAGCURSOR'#2#0#7
+'TABSTOP'#9#7'TABSTOP'#9#4'LEFT'#2#6#6'HEIGHT'#2#20#3'TOP'#2#1#5'WIDTH'#3#171
+#0#0#0#9'TCHECKBOX'#29'IncFilterSimpleSyntaxCheckbox'#8'AUTOSIZE'#9#11'ALLOW'
+'GRAYED'#9#7'ANCHORS'#11#5'aktop'#6'akleft'#0#7'CAPTION'#6#13'Simple Syntax'
+#10'DRAGCURSOR'#2#0#8'TABORDER'#2#1#7'TABSTOP'#9#8'TABORDER'#2#1#7'TABSTOP'#9
+#4'LEFT'#3#196#0#6'HEIGHT'#2#20#3'TOP'#2#2#5'WIDTH'#3#201#0#0#0#9'TCOMBOBOX'
+#21'IncludeFilterCombobox'#7'ANCHORS'#11#5'aktop'#6'akleft'#0#9'MAXLENGTH'#2
+#0#11'PARENTCTL3D'#8#8'TABORDER'#2#2#7'TABSTOP'#9#4'TEXT'#6#21'IncludeFilter'
+'Combobox'#4'LEFT'#2#6#6'HEIGHT'#2#25#3'TOP'#2#25#5'WIDTH'#3#174#1#0#0#0#9'T'
+'GROUPBOX'#21'ExcludeFilterGroupbox'#7'ANCHORS'#11#5'aktop'#6'akleft'#0#7'CA'
+'PTION'#6#14'Exclude Filter'#5'COLOR'#4#5#0#0#128#11'PARENTCTL3D'#8#8'TABORD'
+'ER'#2#7#7'TABSTOP'#9#8'ONRESIZE'#7#27'ExcludeFilterGroupboxRESIZE'#4'LEFT'#2
,#8#6'HEIGHT'#2'O'#3'TOP'#3#0#1#5'WIDTH'#3#192#1#0#9'TCHECKBOX'#24'UseExclude'
+'FilterCheckbox'#8'AUTOSIZE'#9#11'ALLOWGRAYED'#9#7'ANCHORS'#11#5'aktop'#6'ak'
+'left'#0#7'CAPTION'#6#18'Use Exclude Filter'#10'DRAGCURSOR'#2#0#7'TABSTOP'#9
+#7'TABSTOP'#9#4'LEFT'#2#6#6'HEIGHT'#2#20#3'TOP'#2#5#5'WIDTH'#3#151#0#0#0#9'T'
+'CHECKBOX'#29'ExcFilterSimpleSyntaxCheckbox'#8'AUTOSIZE'#9#11'ALLOWGRAYED'#9
+#7'ANCHORS'#11#5'aktop'#6'akleft'#0#7'CAPTION'#6#13'Simple Syntax'#10'DRAGCU'
+'RSOR'#2#0#8'TABORDER'#2#1#7'TABSTOP'#9#8'TABORDER'#2#1#7'TABSTOP'#9#4'LEFT'
+#3#199#0#6'HEIGHT'#2#20#3'TOP'#2#6#5'WIDTH'#3#212#0#0#0#9'TCOMBOBOX'#21'Excl'
+'udeFilterCombobox'#7'ANCHORS'#11#5'aktop'#6'akleft'#0#9'MAXLENGTH'#2#0#11'P'
+'ARENTCTL3D'#8#8'TABORDER'#2#2#7'TABSTOP'#9#4'TEXT'#6#21'ExcludeFilterCombob'
+'ox'#4'LEFT'#2#6#6'HEIGHT'#2#25#3'TOP'#2#30#5'WIDTH'#3#174#1#0#0#0#0
]);

View File

@ -37,7 +37,7 @@ interface
uses
Classes, SysUtils, Forms, Controls, Graphics, LResources, Buttons, StdCtrls,
ProjectDefs, IDEOptionDefs, IDEProcs, InputHistory;
ProjectDefs, IDEOptionDefs, IDEProcs, InputHistory, Dialogs;
type
{ TPublishProjectDialog }
@ -50,10 +50,17 @@ type
CommandAfterCombobox: TCOMBOBOX;
FilesGroupbox: TGROUPBOX;
UseIncludeFilterCheckbox: TCHECKBOX;
IncludeFileFilterCombobox: TCOMBOBOX;
IgnoreBinariesCheckbox: TCHECKBOX;
ExcludeFilterCombobox: TCOMBOBOX;
ExcFilterSimpleSyntaxCheckbox: TCHECKBOX;
UseExcludeFilterCheckbox: TCHECKBOX;
ExcludeFileFilterCombobox: TCOMBOBOX;
ExcludeFilterGroupbox: TGROUPBOX;
IncludeFilterCombobox: TCOMBOBOX;
IncFilterSimpleSyntaxCheckbox: TCHECKBOX;
UseIncludeFilterCheckbox: TCHECKBOX;
IncludeFilterGroupbox: TGROUPBOX;
ProjectInfoGroupbox: TGROUPBOX;
SaveEditorInfoOfNonProjectFilesCheckbox: TCHECKBOX;
@ -63,7 +70,9 @@ type
SaveSettingsButton: TBUTTON;
CancelButton: TBUTTON;
procedure DestDirGroupBoxRESIZE(Sender: TObject);
procedure ExcludeFilterGroupboxRESIZE(Sender: TObject);
procedure FilesGroupboxRESIZE(Sender: TObject);
procedure IncludeFilterGroupboxRESIZE(Sender: TObject);
procedure OkButtonCLICK(Sender: TObject);
procedure ProjectInfoGroupboxResize(Sender: TObject);
procedure PublishProjectDialogResize(Sender: TObject);
@ -75,6 +84,7 @@ type
procedure LoadHistoryLists;
procedure SaveHistoryLists;
procedure SetOptions(const AValue: TPublishProjectOptions);
function CheckFilter: boolean;
public
constructor Create(TheOwner: TComponent); override;
destructor Destroy; override;
@ -116,6 +126,12 @@ begin
SetBounds(Left,Top,Parent.ClientWidth-2*Left,Height);
end;
procedure TPublishProjectDialog.ExcludeFilterGroupboxRESIZE(Sender: TObject);
begin
with ExcludeFilterCombobox do
Width:=ExcludeFilterGroupbox.ClientWidth-2*Left;
end;
procedure TPublishProjectDialog.FilesGroupboxRESIZE(Sender: TObject);
begin
with FilesGroupbox do
@ -124,16 +140,23 @@ begin
SetBounds(Left,Top,Parent.ClientWidth-2*Left,Height);
with UseIncludeFilterCheckbox do
SetBounds(Left,Top,Parent.ClientWidth-2*Left,Height);
with IncludeFileFilterCombobox do
with IncludeFilterCombobox do
SetBounds(Left,Top,Parent.ClientWidth-2*Left,Height);
with UseExcludeFilterCheckbox do
SetBounds(Left,Top,Parent.ClientWidth-2*Left,Height);
with ExcludeFileFilterCombobox do
with ExcludeFilterCombobox do
SetBounds(Left,Top,Parent.ClientWidth-2*Left,Height);
end;
procedure TPublishProjectDialog.IncludeFilterGroupboxRESIZE(Sender: TObject);
begin
with IncludeFilterCombobox do
Width:=IncludeFilterGroupbox.ClientWidth-2*Left;
end;
procedure TPublishProjectDialog.OkButtonCLICK(Sender: TObject);
begin
if not CheckFilter then exit;
if Options<>nil then SaveToOptions(Options);
end;
@ -153,12 +176,16 @@ begin
SetBounds(Left,Top,Parent.ClientWidth-2*Left,Height);
with ProjectInfoGroupbox do
SetBounds(Left,Top,Parent.ClientWidth-2*Left,Height);
with IncludeFilterGroupbox do
Width:=Parent.ClientWidth-2*Left;
with ExcludeFilterGroupbox do
Width:=Parent.ClientWidth-2*Left;
end;
procedure TPublishProjectDialog.SaveSettingsButtonClick(Sender: TObject);
begin
if Options<>nil then
SaveToOptions(Options);
if not CheckFilter then exit;
if Options<>nil then SaveToOptions(Options);
end;
procedure TPublishProjectDialog.SetComboBox(AComboBox: TComboBox;
@ -189,15 +216,15 @@ begin
// file filter
List:=InputHistories.HistoryLists.GetList(PublishProjectIncludeFileFilter,true);
if List.Count=0 then begin
List.Add('*.{pas,pp,inc,lfm,lpr,lrs,lpi,lpk,fpc,sh,xml}');
List.Add(DefPublProjIncFilter);
end;
IncludeFileFilterCombobox.Items.Assign(List);
IncludeFilterCombobox.Items.Assign(List);
List:=InputHistories.HistoryLists.GetList(PublishProjectExcludeFileFilter,true);
if List.Count=0 then begin
List.Add('*.{bak,ppu,ppw,o,so};*~;backup');
List.Add(DefPublProjExcFilter);
end;
ExcludeFileFilterCombobox.Items.Assign(List);
ExcludeFilterCombobox.Items.Assign(List);
end;
procedure TPublishProjectDialog.SaveHistoryLists;
@ -213,12 +240,12 @@ begin
CommandAfterCombobox.Items);
// file filter
SetComboBox(IncludeFileFilterCombobox,IncludeFileFilterCombobox.Text,20);
SetComboBox(IncludeFilterCombobox,IncludeFilterCombobox.Text,20);
InputHistories.HistoryLists.GetList(PublishProjectIncludeFileFilter,true).Assign(
IncludeFileFilterCombobox.Items);
SetComboBox(ExcludeFileFilterCombobox,ExcludeFileFilterCombobox.Text,20);
IncludeFilterCombobox.Items);
SetComboBox(ExcludeFilterCombobox,ExcludeFilterCombobox.Text,20);
InputHistories.HistoryLists.GetList(PublishProjectExcludeFileFilter,true).Assign(
ExcludeFileFilterCombobox.Items);
ExcludeFilterCombobox.Items);
end;
procedure TPublishProjectDialog.SetOptions(const AValue: TPublishProjectOptions
@ -229,13 +256,30 @@ begin
LoadFromOptions(FOptions);
end;
function TPublishProjectDialog.CheckFilter: boolean;
begin
Result:=false;
if Options<>nil then begin
if not Options.IncludeFilterValid then begin
if MessageDlg('Invalid Include filter',mtError,[mbIgnore,mbCancel],0)
=mrCancel
then exit;
end;
if not Options.ExcludeFilterValid then begin
if MessageDlg('Invalid Exclude filter',mtError,[mbIgnore,mbCancel],0)
=mrCancel
then exit;
end;
end;
Result:=true;
end;
constructor TPublishProjectDialog.Create(TheOwner: TComponent);
begin
inherited Create(TheOwner);
Position:=poScreenCenter;
IDEDialogLayoutList.ApplyLayout(Self,500,405);
IDEDialogLayoutList.ApplyLayout(Self,500,470);
LoadHistoryLists;
FilesGroupbox.Enabled:=false;
end;
destructor TPublishProjectDialog.Destroy;
@ -252,10 +296,13 @@ begin
SetComboBox(CommandAfterCombobox,SrcOpts.CommandAfter,20);
// file filter
IgnoreBinariesCheckbox.Checked:=SrcOpts.IgnoreBinaries;
UseIncludeFilterCheckbox.Checked:=SrcOpts.UseIncludeFileFilter;
SetComboBox(IncludeFileFilterCombobox,SrcOpts.IncludeFileFilter,20);
IncFilterSimpleSyntaxCheckbox.Checked:=SrcOpts.IncludeFilterSimpleSyntax;
SetComboBox(IncludeFilterCombobox,SrcOpts.IncludeFileFilter,20);
UseExcludeFilterCheckbox.Checked:=SrcOpts.UseExcludeFileFilter;
SetComboBox(ExcludeFileFilterCombobox,SrcOpts.ExcludeFileFilter,20);
ExcFilterSimpleSyntaxCheckbox.Checked:=SrcOpts.ExcludeFilterSimpleSyntax;
SetComboBox(ExcludeFilterCombobox,SrcOpts.ExcludeFileFilter,20);
// project info
SaveEditorInfoOfNonProjectFilesCheckbox.Checked:=
@ -272,10 +319,13 @@ begin
DestOpts.CommandAfter:=CommandAfterCombobox.Text;
// file filter
DestOpts.IgnoreBinaries:=IgnoreBinariesCheckbox.Checked;
DestOpts.UseIncludeFileFilter:=UseIncludeFilterCheckbox.Checked;
DestOpts.IncludeFileFilter:=IncludeFileFilterCombobox.Text;
DestOpts.IncludeFilterSimpleSyntax:=IncFilterSimpleSyntaxCheckbox.Checked;
DestOpts.IncludeFileFilter:=IncludeFilterCombobox.Text;
DestOpts.UseExcludeFileFilter:=UseExcludeFilterCheckbox.Checked;
DestOpts.ExcludeFileFilter:=ExcludeFileFilterCombobox.Text;
DestOpts.ExcludeFilterSimpleSyntax:=ExcFilterSimpleSyntaxCheckbox.Checked;
DestOpts.ExcludeFileFilter:=ExcludeFilterCombobox.Text;
// project info
DestOpts.SaveEditorInfoOfNonProjectFiles:=

View File

@ -53,8 +53,10 @@ function FileIsExecutable(const AFilename: string): boolean;
function GetFileDescription(const AFilename: string): string;
// directories
function DirectoryExists(const Name: String): Boolean;
function DirectoryExists(const FileName: String): Boolean;
function ForceDirectory(DirectoryName: string): boolean;
function DeleteDirectory(const DirectoryName: string;
OnlyChilds: boolean): boolean;
// filename parts
function ExtractFileNameOnly(const AFilename: string): string;
@ -104,6 +106,9 @@ end.
{
$Log$
Revision 1.7 2002/12/17 19:49:34 mattias
finished publish project
Revision 1.6 2002/12/12 17:47:44 mattias
new constants for compatibility

View File

@ -19,15 +19,14 @@
{------------------------------------------------------------------------------
DirectoryExists
------------------------------------------------------------------------------}
function DirectoryExists(const Name: String): Boolean;
function DirectoryExists(const FileName: String): Boolean;
var
F: Longint;
dirExist: Boolean;
begin
//Result := FileExist(Name);
dirExist := false;
dirExist := false;
F := FileGetAttr(Name);
F := FileGetAttr(FileName);
if F <> -1 then
if (F and faDirectory) <> 0 then
dirExist := true;
@ -489,6 +488,42 @@ begin
Result:=true;
end;
{------------------------------------------------------------------------------
function DeleteDirectory(const DirectoryName: string;
OnlyChilds: boolean): boolean;
------------------------------------------------------------------------------}
function DeleteDirectory(const DirectoryName: string;
OnlyChilds: boolean): boolean;
const
{$IFDEF Win32}
FindMask = '*.*';
{$ELSE}
FindMask = '*';
{$ENDIF}
var
FileInfo: TSearchRec;
CurSrcDir: String;
CurFilename: String;
begin
Result:=false;
CurSrcDir:=CleanAndExpandDirectory(DirectoryName);
if SysUtils.FindFirst(CurSrcDir+FindMask,faAnyFile,FileInfo)=0 then begin
repeat
// check if special file
if (FileInfo.Name='.') or (FileInfo.Name='..') then continue;
CurFilename:=CurSrcDir+FileInfo.Name;
if (FileInfo.Attr and faDirectory)>0 then begin
if not DeleteDirectory(CurFilename,false) then exit;
end else begin
if not DeleteFile(CurFilename) then exit;
end;
until SysUtils.FindNext(FileInfo)<>0;
end;
SysUtils.FindClose(FileInfo);
if (not OnlyChilds) and (not RemoveDir(DirectoryName)) then exit;
Result:=true;
end;
{------------------------------------------------------------------------------
function CleanAndExpandFilename(const Filename: string): string;
------------------------------------------------------------------------------}
@ -596,6 +631,9 @@ end;
{
$Log$
Revision 1.6 2002/12/17 19:49:34 mattias
finished publish project
Revision 1.5 2002/12/12 17:47:46 mattias
new constants for compatibility