ISDone

DLL ISDone 0.6 final

Нет прав для скачивания
Как в Isdone реализовать копирование файла с одной папки в другую?
 
Код:
procedure CopyDir(const fromDir, toDir:String);
var
  searchResult : TFindRec;
begin             
  if fromDir[Length(fromDir)]<>'\' then fromDir:=fromDir+'\';   
  if toDir[Length(toDir)]<>'\' then toDir:=toDir+'\';
  ForceDirectories(toDir);
  if FindFirst(fromDir+'*.*', searchResult) then
  begin
    repeat     
      Application.ProcessMessages();
      if (searchResult.Attributes and FILE_ATTRIBUTE_DIRECTORY ) <> FILE_ATTRIBUTE_DIRECTORY  then
      begin
        if FileExists(toDir+searchResult.name) then
          DeleteFile(toDir+searchResult.name); 
        FileCopy(fromDir+searchResult.name, toDir+searchResult.name, false); 
      end else if (searchResult.Name <> '..') and (searchResult.Name <> '.') then
        CopyDir(fromDir + searchResult.Name, toDir + searchResult.Name);
    until not FindNext(searchResult);
    FindClose(searchResult);
  end;
end;

/////Копирует всё из папки {app}\test в папку {app}
вставить после распаковки архива
Код:
CopyDir(ExpandConstant('{app}\test\'), ExpandConstant('{app}'));


/////Удаляет папку {app}\test после копирования, вставить после копирования
Код:
DelTree(ExpandConstant('{app}\test\'), True, True, True);

и вообще можно использовать MoveDir
 
как то так
Код:
CopyDir(ExpandConstant('{app}\путь_к_копируемому_файлу_\filename.txt'), ExpandConstant('{app}\куда_нам_надо_скопировать_файл'));
 
if not ISArcExtract ( 0, 0, ExpandConstant('{tmp}\ukr.bin'), ExpandConstant('{app}\'), '', true, '', ExpandConstant('{tmp}\arc.ini'), ExpandConstant('{tmp}\'), notPCFonFLY{PCFonFLY}) then break;
CopyDir(ExpandConstant('{app}\update\update.rpf'), ExpandConstant('{app}\update_backup'));
MoveDir(ExpandConstant('{app}\update\update.rpf'), ExpandConstant('{app}\'));
if not ISxDeltaExtract ( 0, 0, 0, 640, ExpandConstant('{app}\update.rpf'), ExpandConstant('{app}\update.dif'), ExpandConstant('{app}\update\update.rpf'), true, true) then break;
Вот как задал и неработаєт.
 
для MoveDir нужна процедура
на всякий случай, MoveDir - это перенос файла/папки, CopyDir - это копирование файла/папки
Код:
procedure MoveDir(const fromDir, toDir:String);
var
  searchResult : TFindRec;
begin             
  if fromDir[Length(fromDir)]<>'\' then fromDir:=fromDir+'\';   
  if toDir[Length(toDir)]<>'\' then toDir:=toDir+'\';
  ForceDirectories(toDir);
  if FindFirst(fromDir+'*.*', searchResult) then
  begin
    repeat     
      Application.ProcessMessages();
      if (searchResult.Attributes and FILE_ATTRIBUTE_DIRECTORY ) <> FILE_ATTRIBUTE_DIRECTORY  then
      begin   
        if FileExists(toDir+searchResult.name) then
          DeleteFile(toDir+searchResult.name); 
        RenameFile(fromDir+searchResult.name, toDir+searchResult.name); 
      end else if (searchResult.Name <> '..') and (searchResult.Name <> '.') then
        MoveDir(fromDir + searchResult.Name, toDir + searchResult.Name);
    until not FindNext(searchResult);
    FindClose(searchResult);
  end;
end;
 
Код:
procedure CopyDir(const fromDir, toDir:String);
var
  searchResult : TFindRec;
begin
  if fromDir[Length(fromDir)]<>'\' then fromDir:=fromDir+'\';
  if toDir[Length(toDir)]<>'\' then toDir:=toDir+'\';
  ForceDirectories(toDir);
  if FindFirst(fromDir+'*.*', searchResult) then
  begin
    repeat
      Application.ProcessMessages();
      if (searchResult.Attributes and FILE_ATTRIBUTE_DIRECTORY ) <> FILE_ATTRIBUTE_DIRECTORY  then
      begin
        if FileExists(toDir+searchResult.name) then
          DeleteFile(toDir+searchResult.name);
        FileCopy(fromDir+searchResult.name, toDir+searchResult.name, false);
      end else if (searchResult.Name <> '..') and (searchResult.Name <> '.') then
        CopyDir(fromDir + searchResult.Name, toDir + searchResult.Name);
    until not FindNext(searchResult);
    FindClose(searchResult);
  end;
end;

procedure MoveDir(const fromDir, toDir:String);
var
  searchResult : TFindRec;
begin
  if fromDir[Length(fromDir)]<>'\' then fromDir:=fromDir+'\';
  if toDir[Length(toDir)]<>'\' then toDir:=toDir+'\';
  ForceDirectories(toDir);
  if FindFirst(fromDir+'*.*', searchResult) then
  begin
    repeat
      Application.ProcessMessages();
      if (searchResult.Attributes and FILE_ATTRIBUTE_DIRECTORY ) <> FILE_ATTRIBUTE_DIRECTORY  then
      begin
        if FileExists(toDir+searchResult.name) then
          DeleteFile(toDir+searchResult.name);
        FileCopy(fromDir+searchResult.name, toDir+searchResult.name, false);
      end else if (searchResult.Name <> '..') and (searchResult.Name <> '.') then
        MoveDir(fromDir + searchResult.Name, toDir + searchResult.Name);
    until not FindNext(searchResult);
    FindClose(searchResult);
  end;
end;
 
сори мой косяк
Код:
        FileCopy(ExpandConstant('{app}\путь_к_копируемому_файлу_\filename.txt'), ExpandConstant('{app}\\куда_нам_надо_скопировать_файл'), false);
 
FileCopy(ExpandConstant('{app}\update\update.rpf'), ExpandConstant('{app}\update_backup\update.rpf'), false);
Так работаєт

А как переместить один файл?
И за что отвечаєт --> , false);
 
Последнее редактирование модератором:
stalqer, из справки
Pascal Scripting: FileCopy
Прототип:

function FileCopy(const ExistingFile, NewFile: String; const FailIfExists: Boolean): Boolean;

Описание:
Копирует ExistingFile в NewFile, сохраняя отметки времени и атрибуты файла.
Если FailIfExists является True, то функция не выполнится, если NewFile уже существует, иначе просто перезапишет файл.
При удачном выполнении возвращает True, иначе False.
 

Вложения

stalqer, достаточно нажать под сообщением, "мне нравится" / человек увидит, что его сообщение вам помогло, ну или было полезным для вас. Спасибо.
 
Парни сорри за нубский вопрос но.
Впервые потребовалось разбить репак для записи на болванки а не найду в скрипте такой функции.. Кто поможет? Очень надо
 
Hi, I'm having difficulty getting the time left and elapsed time to work correctly, It is presenting itself as question marks and I am not too sure why. I don't really understand Russian so I couldn't find a resolution to my issue. If anyone is able to help me out it would be greatly appreciated, Thank you.

2049f929c240773d9b666479fb7204d1-png.jpg
I have also attached the script file.
 

Вложения

Lunac4d, еxcerpt from help + google translate:
Short instructions:
  1. First, comment out the line #define records
  2. Compile the project and run the installation. This will be our test pass. All operations must go to the end and complete successfully.
  3. After the test run in the specified folder creates the records.inf file, you need to add it to the project by uncommenting the line #define records
  4. Again compile the project. After that, the installer is ready to work.
 
Назад
Сверху