2011-02-25 4 views
17

इनो सेटअप में कमांड लाइन पैरामीटर /LOG="filename" है। क्या मैं इनो सेटअप स्क्रिप्ट के अंदर से एक लॉग फ़ाइल नाम निर्दिष्ट कर सकता हूं, इसलिए मैं इसे बाद में अपनी त्रुटि रिपोर्ट में शामिल कर सकता हूं?मैं इनो सेटअप इंस्टॉलेशन को कैसे लॉग कर सकता हूं?

उत्तर

16

आप SetupLogging विकल्प (SetupLogging=yes) सेट कर सकते हैं और फिर लॉग को कॉपी करने के लिए निम्न स्क्रिप्ट में निम्न कोड को एकीकृत कर सकते हैं।

procedure CurStepChanged(CurStep: TSetupStep); 
var 
    logfilepathname, logfilename, newfilepathname: string; 
begin 
    logfilepathname := ExpandConstant('{log}'); 
    logfilename := ExtractFileName(logfilepathname); 
    newfilepathname := ExpandConstant('{app}\') + logfilename; 

    if CurStep = ssDone then 
    begin 
    FileCopy(logfilepathname, newfilepathname, false); 
    end; 
end; 
+6

क्या आपको सचमुच लगता है कि प्रत्येक सेटअप चरण के लिए पथ और फ़ाइल नामों को बार-बार पुन: गणना करना आवश्यक है? क्यों नहीं 'अगर CurStep = ssDone तब' ब्लॉक में ले जाएं? –

+6

+1 मिथिल! मैंने आपकी टिप का उपयोग किया है लेकिन इसके बजाय DeinitializeSetup में कॉल करें। फिर लॉग की प्रतिलिपि बनाई जाती है भले ही उपयोगकर्ता कुछ भी स्थापित होने से पहले सेटअप से बाहर निकल जाए। – Lars

10
लार्स से टिप्पणी के बाद

मैं DeinitializeSetup() प्रक्रिया का इस्तेमाल किया है, लेकिन मैं भी निर्देशिका है कि इंस्टॉलर के बजाय {app} निरंतर से चलाया जाता है करने के लिए लॉग फ़ाइल की प्रतिलिपि करने {src} निरंतर उपयोग करने के लिए नई फ़ाइल पथ बदल जो यदि उपयोगकर्ता स्थापना रद्द कर सकता है तो हो सकता है/नहीं:

// Called just before Setup terminates. Note that this function is called even if the user exits Setup before anything is installed. 
procedure DeinitializeSetup(); 
var 
    logfilepathname, logfilename, newfilepathname: string; 
begin 
    logfilepathname := ExpandConstant('{log}'); 
    logfilename := ExtractFileName(logfilepathname); 
    // Set the new target path as the directory where the installer is being run from 
    newfilepathname := ExpandConstant('{src}\') + logfilename; 

    FileCopy(logfilepathname, newfilepathname, false); 
end;