autoupgrader Self-upgrading mechanism
AutoUpgrader component
Return to Introduction  Previous page  Next page
Self-upgrading mechanism, how does it works?
When the AutoUpgrader downloads required files from the Web it stores them to the working directory with "*.*.uTMP" extensions. It also set for them "temporary" and "hidden" attributes, so user will not see these files.  
 
After successful downloading, the AutoUpgrader extracts so-called self-upgrading module (Upgrader4.exe, 9KB), which performs local updates to the TEMP directory, execute it then terminate the main app itself. The self-upgrading mechanism replaces all files with newer ones and restart the main application.  
 
The self-upgrading module (Upgrader4.exe) performs the local updates with following steps:  
 1. Read queue file (Temp\UpgraderQueue.txt) to locate files outside of  
    main Program directory.  // added in v4.0  
 2. Locate program directory by exe-name transmitted as command-line parameter  
 2.1. Check whether the AutoUpgrader uses the external setup program (#method=1)  
 2.2. Split the file name and parameters  
 2.3. Split the file name and path  
 3. Test whether an exe-file exists + get the filename with correct charcase  
 4. Awaiting for termination of the main program  
 5. Test whether newer (downloaded) exe-file exists  
 6. Rename/replace downloaded files outside of main program directory  // added in v4.0  
 7. Find all (.uTMP) files downloaded to main program directory  
 7.1. If this is executable AND newest exe still not found -- trying to  
      use another suitable EXE. (This may happends if program was renamed  
      by user, or local update should be done by external setup.)  
 7.2. Rename .uTMP file to its normal name  
 8. Re-execute main program (or setup file).  
 9. Delete the queue file (if exists) // added in v4.0  
New steps added in v3.1.1:  
 10. IF the local update should be done by external setup THEN (else terminate)  
 10.1. Wait until termination of setup program  
 10.2. Delete the setup (we don't need it anymore after installation?)  
 10.3. Restart the original main app  

Note
iiwarning If you wish to use AutoUpgrader for downloading just single setup-file which will perform all further updates — make sure that UpgradeMethod = umUseExternalSetup (#method=1 in the Info-file). Otherwise the self-upgrading module will replace your program with downloaded setup.