2014-07-07 1 views
2

설치 대상 폴더 ({app})에 선택한 구성 요소의 install.log를 만들어야하지만 설치 프로그램을 실행할 때 문제가 발생합니다. 파일이 존재하지 않습니다 C : /tmp/exe/install.log "나는 그것이"exe "dir을 아직 만들지 않았다는 것을 의미합니다. 내가 어떻게 우회 할 수 있니?InnoSetup install.log에 대한 {app} dir 만들기

procedure CurStepChanged(CurStep: TSetupStep); 
var 
    I: Integer; 
    LogList: TStringList; 
begin 
    if CurStep = ssInstall then 
    begin 
    LogList := TStringList.Create; 
    try 
     LogList.Add('Selected components:'); 
     for I := 0 to WizardForm.ComponentsList.Items.Count - 1 do 
     if WizardForm.ComponentsList.Checked[I] then 
      LogList.Add('Component: ' + WizardForm.ComponentsList.ItemCaption[I]); 

     LogList.SaveToFile(ExpandConstant('{app}\install.log')); 
    finally 
     LogList.Free; 
    end; 
    end; 
end; 
+0

왜 상수가 아닌 것을 'ExpandConstant'하려고합니까? 'ExpandConstant ('{app}') + '\ install.log''를 대신 사용해보고 도움이되는지 확인하십시오. (당신은 백 슬래시없이 시도해야 할 수도 있습니다, 상수를 확장하는 것이 포함되는지 여부는 기억이 안납니다.) 문제가되어서는 안되는 –

+0

흠. 왜냐하면 나는'ExpandConstant ('{userdocs} \ install.log')'를 전에했기 때문에 제대로 작동합니다. 그러나 아마도 그것은 당신의 방식대로하는 것이 더 좋은 방법 일 것입니다. 그러나 나는 그 문제를 해결할 것이라고 생각하지 않는다. –

+0

당신은 실제로 너무 일찍 (그것이 생성되기 전에) 폴더에 접근하려 할 수도있다. 나중에 설치 (예 : 설치 후) 단계로 옮길 수도 있습니다. 설치가 확실 할 수 있습니다. –

답변

1

아직 실제로 생성되기 전에 프로세스에서 너무 일찍 폴더에 액세스하려는 것으로 의심됩니다.

ssPostInstall과 같이 프로세스의 다음 단계로 변경해보십시오. 이 시점에서 폴더가 생성되었음을 확실히 알 수 있습니다. 나머지 코드는 동일하게 유지되어야합니다.

procedure CurStepChanged(CurStep: TSetupStep); 
var 
    I: Integer; 
    LogList: TStringList; 
begin 
    if CurStep = ssPostInstall then 
    begin 
    LogList := TStringList.Create; 
    try 
     LogList.Add('Selected components:'); 
     for I := 0 to WizardForm.ComponentsList.Items.Count - 1 do 
     if WizardForm.ComponentsList.Checked[I] then 
      LogList.Add('Component: ' + WizardForm.ComponentsList.ItemCaption[I]); 

     LogList.SaveToFile(ExpandConstant('{app}\install.log')); 
    finally 
     LogList.Free; 
    end; 
    end; 
end; 
+0

네, 이것으로 해결했습니다! –