A common request is how to add support for offline updates alongside the traditional online updates. This article will walk you through the steps you need to take to support both online and offline updates.
Step 1. Configuring your download sites
The first thing you need to do is to make some changes to your download sites in wyBuild. Typically, if you have followed the step-by-step walkthrough, you'd have a single download site like "
http://example.com/updates/%file%". However, you need to make a few modifications in order to support offline updates.
When wyUpdate checks for updates it downloads the *.wys file (e.g. wyserver.wys). This "server file" has the latest changes and the URLs of where the actual update files (*.wyu) are stored. When wyUpdate reads this "server file" and sees your app needs an update it will download the appropriate update patch file (*.wyu).
When you just specify one download site (like "
http://example.com/updates/%file%") wyBuild knows that you'll be storing both your "server file" (*.wys) and "update files" (*.wyu) in the same location on your server. However to support offline updates you have to do 2 things to your server sites:
- You need to changes your "regular" download site to a "server only site". That is, in the download list, right click the download site and click the "Just a server site (*.wys)" option.
- Now you'll need to add a site where the updates will be downloaded from. Type "
%updatepath%/%file%" (without the quotes) and add it to the download sites. Then right click it and choose the "Just an update site (*.wyu) option.
Step 2. Rebuild wyUpdate and your updates
Now you need to rebuild both wyUpdate and your updates. Also upload your updates to your server.
Step 3 (option 1). Online updates
To do online updates it's almost exactly the same as before. However there's one difference. You need to tell wyUpdate what "%updatepath%" means. In other words you need to pass in the server location where your update files are stored. For example:
wyUpdate will replace the %updatepath% variable you put in the download sites list with the value you passed in to wyUpdate.exe using the "-updatepath" commandline option.
Step 3 (option 2). Offline updates
Similarly, it follows that for offline updates instead of passing in a download site on the internet (like "
http://example.com/updates") you'll pass in a location on the user's computer. Let's say you stored the "server file" and "update files" in "C:\path\to" folder on the user's computer. You'll use the "-server" and "-updatepath" commandline options passing in the local location of the server file and the location where the updates are stored. For example:
wyUpdate.exe -server="file:///C:/path/to/wyserver.wys" -updatepath="file:///C:/path/to"