bialix
можно сделать простой батник, который будет делать автоматизацию этого процесса перед запуском собственно вашей программы.
Я подобную задачу для себя давно решил сравнивая даты ехе-шника и архива.
cd .\locale\ru\LC_MESSAGES
..\..\..\launcher \\srv\exchange\miha\kaa\locale\ru\LC_MESSAGES\kwindow.mo
launcher \\srv\exchange\miha\kaa\library.zip
7za.exe d library.zip config.pyc
7za.exe u library.zip config.py
launcher r \\srv\exchange\miha\kaa\kwinit.exe
exit
Таким образом обновляется только 1 файл из library.zip, который собирается 1 раз.
Программа, которая сравнивает дату и размер на делфи:
program launcher;
{$APPTYPE CONSOLE}
uses
Windows,
SysUtils,
Classes;
function FileLength(const FileName: string): Int64;
var
FileHandle: Integer;
begin
Result := -1;
FileHandle := FileOpen(FileName, fmOpenRead or fmShareDenyWrite);
if FileHandle = -1 then
Exit;
try
Result := FileSeek(FileHandle, Int64(0), 2);
finally
FileClose(FileHandle);
end;
end;
//******************************************************************************
procedure help;
begin
writeln ('*************************************************************************');
writeln ('* Usage Launcher.exe *');
writeln ('* Launcher.exe *');
writeln ('* : *');
writeln ('* r or R - copy and run PATH file *');
writeln ('* <NONE> - copy but not run PATH file *');
writeln ('* *');
writeln ('* : *');
writeln ('* If you call this program with option “r” then all symbols before [FULL*');
writeln ('* PATH TO FILENAME] perceiving as execute filename''s options *');
writeln ('* *');
writeln ('*************************************************************************');
writeln ('Press ENTER to EXIT');
readln;
end;
//******************************************************************************
procedure load(path, option, cmd_option:string);
var f:string;
begin
if not FileExists(path) then
writeln ('cannot find file ‘+path);
f:=’./'+ExtractFileName(path);
if (not FileExists(f)) or
(FileAge(f) <> FileAge(path)) or (FileLength(f) <> FileLength(path)) then
if not copyfile(PChar(path), PChar('./'+ExtractFileName(path)), false) then
writeln ('cannot load file ‘+path) else writeln (’File ‘+path +’ was loaded');
if (option='r') and ((ExtractFileExt(path)='.exe')
or (ExtractFileExt(path)='.com') or(ExtractFileExt(path)='.bat'))
then begin
if not WinExec(PChar(f+cmd_option), SW_RESTORE)=0 then
writeln ('cannot execute file ‘+f+cmd_option)
else writeln (’File ‘+f +cmd_option+’ was executed');
end;
end;
//******************************************************************************
var
I: Integer;
Cmd, option, Cmd_Options: string;
begin
if ParamCount = 0 then
help;
case ParamCount of
1:begin
if length(ParamStr(1))>1 then
begin
Cmd := lowercase(ParamStr(1));
load(ExpandUNCFileName(Cmd), ‘0’, ‘');
end else
help;
end;
2:begin
Cmd := lowercase(ParamStr(2));
option:= lowercase(ParamStr(1));
load(ExpandUNCFileName(Cmd), Option, ’');
end;
else begin
if lowercase(ParamStr(1)) <> ‘r’ then help
else begin
Cmd := lowercase(ParamStr(2));
option:= lowercase(ParamStr(1));
Cmd_Options:='';
for I:=3 to ParamCount do
Cmd_Options:=Cmd_Options+' '+ParamStr(I);
load(ExpandUNCFileName(Cmd), Option, Cmd_Options);
end;
end;
end;//case
end.
и на PhreePascal
program launcher;
{$APPTYPE CONSOLE}
uses
Dos, Windows, SysUtils;
//******************************************************************************
function FileLength(const FileName: string): Int64;
var
FileHandle: Integer;
begin
Result := -1;
FileHandle := FileOpen(FileName, fmOpenRead or fmShareDenyWrite);
if FileHandle = -1 then
Exit;
try
Result := FileSeek(FileHandle, Int64(0), 2);
finally
FileClose(FileHandle);
end;
end;
//******************************************************************************
procedure help;
begin
writeln ('*************************************************************************');
writeln ('* Usage Launcher.exe *');
writeln ('* Launcher.exe *');
writeln ('* : *');
writeln ('* r or R - copy and run PATH file *');
writeln ('* <NONE> - copy but nozt run PATH file *');
writeln ('* *');
writeln ('* : *');
writeln ('* If you call this program with option “r” then all symbols before [FULL*');
writeln ('* PATH TO FILENAME] perceiving as execute filename''s options *');
writeln ('* *');
writeln ('*************************************************************************');
writeln ('Press ENTER to EXIT');
readln;
end;
//******************************************************************************
procedure load(path, option, cmd_option:string);
var f:string;
begin
if not FileExists(path) then
writeln ('cannot find file ‘+path);
f:=’./'+ExtractFileName(path);
if (not FileExists(f)) or
(FileAge(f) <> FileAge(path)) or (FileLength(f) <> FileLength(path)) then
begin
if not copyfile(PChar(ExpandFileName(path)), PChar('./'+ExtractFileName(path)), true) then
writeln ('cannot load file ‘+path)
else writeln (’File ‘+path +’ was loaded');
end;
if (option='r') and ((ExtractFileExt(path)='.exe')or (ExtractFileExt(path)='.com')
or(ExtractFileExt(path)='.bat'))
then begin
Exec(f, cmd_option);
if DosExitCode=0 then
writeln ('cannot execute file ‘+f+cmd_option)
else writeln (’File ‘+f +cmd_option+’ was executed');
end;
end;
//******************************************************************************
var
I: Integer;
Cmd, option, Cmd_Options: string;
begin
if ParamCount = 0 then
begin
help;
Exit;
end;
case ParamCount of
1:begin
if length(ParamStr(1))>1 then
begin
Cmd := lowercase(ParamStr(1));
load(ExpandUNCFileName(Cmd), ‘0’, ‘');
end else
help;
end;
2:begin
Cmd := lowercase(ParamStr(2));
option:= lowercase(ParamStr(1));
load(ExpandUNCFileName(Cmd), Option, ’');
end;
else begin
if lowercase(ParamStr(1)) <> ‘r’ then help
else begin
Cmd := lowercase(ParamStr(2));
option:= lowercase(ParamStr(1));
Cmd_Options:='';
for I:=3 to ParamCount do
Cmd_Options:=Cmd_Options+' '+ParamStr(I);
load(ExpandUNCFileName(Cmd), Option, Cmd_Options);
end;
end;
end;//case
end.
Могу дать готовый ехе-шник. А вообще я пришел к выводу, что то, что импортируется выгодней держать в базе данных, обновляя при необходимости.