From 4b380c9c8139e94fd002d1930828f199a9143696 Mon Sep 17 00:00:00 2001 From: mattias Date: Wed, 10 Jan 2024 12:05:47 +0100 Subject: [PATCH] releasecreator: copy folder --- tools/releasecreator/Pas2jsReleaseCreator.lpr | 25 +++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/tools/releasecreator/Pas2jsReleaseCreator.lpr b/tools/releasecreator/Pas2jsReleaseCreator.lpr index f7f2a74..f4b5b39 100644 --- a/tools/releasecreator/Pas2jsReleaseCreator.lpr +++ b/tools/releasecreator/Pas2jsReleaseCreator.lpr @@ -39,11 +39,14 @@ type constructor Create(TheOwner: TComponent); override; destructor Destroy; override; procedure WriteHelp; virtual; + procedure ReadVersion; procedure CheckForgottenWriteln; procedure CleanSources; procedure CreateBuildSourceDir(const TargetOS, TargetCPU: string); procedure BuildTools(const TargetOS, TargetCPU: string); + procedure CopySourceFolders; + procedure RunTool(WorkDir, Exe: string; const ProcParams: TStringDynArray); overload; procedure RunTool(WorkDir, Exe: string; ProcParams: TStringList); overload; procedure ForceDir(Dir, DirTitle: string); @@ -428,6 +431,28 @@ begin end; end; +procedure TPas2jsReleaseCreator.CopySourceFolders; + + procedure CopyFolder(const Dir: string); + var + SrcDir, DestDir: String; + begin + SrcDir:=SourceDir+Dir; + DestDir:=BuildDir_Sources+Dir; + if not DirectoryExists(SrcDir) then + Err('Unable to copy missing source folder "'+SrcDir+'"'); + + // git restore SrcDir + RunTool(SourceDir,GitFilename,['restore',SrcDir]); + // copy + Log(etInfo,'Copying folder "'+SrcDir+'" -> "'+DestDir+'"'); + CopyDirTree(SrcDir,DestDir,[cffCreateDestDirectory]); + end; + +begin + CopyFolder('demo'); +end; + procedure TPas2jsReleaseCreator.RunTool(WorkDir, Exe: string; const ProcParams: TStringDynArray); var