Цитата Raf-9600:
Ибо вот только что проверил и никакой конвертации не произошло... »
|
Raf-9600, ясно, ведь в указанных папках ogg-файлов нет, они глубже - в подпапках. Вот вариант №2, универсальный. В процедуру RecodeOgg добавлен параметр Recurse (True - искать в подпапках, False - только в указанной папке).
читать дальше »
[code]
Код:

var
RecodePage: TOutputProgressWizardPage;
function FindFiles(Path, Mask: String; Recurse: BOOL): TArrayOfString;
var
FindRecAll, FindRecMask: TFindRec;
begin
if not DirExists(Path) then Exit;
//
if FindFirst(AddBackslash(RemoveBackslash(Path)) + Mask, FindRecMask) then
try
repeat
if (FindRecMask.Attributes and FILE_ATTRIBUTE_DIRECTORY = 0) then
begin
SetArrayLength(Result, GetArrayLength(Result)+1);
Result[GetArrayLength(Result)-1] := AddBackslash(RemoveBackslash(Path)) + FindRecMask.Name;
end;
until not FindNext(FindRecMask);
finally
FindClose(FindRecMask);
end;
//
if Recurse then
begin
if FindFirst(AddBackslash(RemoveBackslash(Path)) + '*', FindRecAll) then
try
repeat
if (FindRecAll.Attributes and FILE_ATTRIBUTE_DIRECTORY <> 0) and (FindRecAll.Name <> '.') and (FindRecAll.Name <> '..') then
Result := FindFiles(AddBackslash(RemoveBackslash(Path)) + FindRecAll.Name, Mask, Recurse);
until not FindNext(FindRecAll);
finally
FindClose(FindRecAll);
end;
end;
end;
procedure RecodeOgg(Path, Mask: String; Recurse: BOOL);
var
iFiles: TArrayOfString;
ResultCode, i: Longint;
begin
try
RecodePage.Show;
iFiles := FindFiles(Path, Mask, Recurse);
for i := 1 to GetArrayLength(iFiles) do
begin
RecodePage.SetProgress(i, GetArrayLength(iFiles));
RecodePage.SetText(iFiles[i-1], IntToStr(i*100/GetArrayLength(iFiles)) + ' %');
Exec(ExpandConstant('{app}\oggdec.exe'), '-Q ' + AddQuotes(iFiles[i-1]), '', SW_HIDE, EwWaitUntilTerminated, ResultCode);
DeleteFile(iFiles[i-1]);
end;
finally
RecodePage.Hide;
end;
end;
procedure InitializeWizard();
begin
RecodePage := CreateOutputProgressPage('Обработка файлов', '');
end;
procedure CurStepChanged(CurStep: TSetupStep);
begin
if CurStep = ssPostInstall then
begin
if IsComponentSelected('GameVoice') then RecodeOgg(ExpandConstant('{app}\data\local\sfx'), '*.ogg', True);
if IsComponentSelected('Music') then RecodeOgg(ExpandConstant('{app}\data\global\music'), '*.ogg', True);
end;
end;
P.S. Не увидел в вашем коде привязку какого-нибудь файла к компоненту.
P.P.S. Вместо выделенных строк можете написать для теста чего-нибудь нейтральное, типа Sleep(100).