-
-
Notifications
You must be signed in to change notification settings - Fork 51
Creating Patches
NOTE: before creating your first patch, you should integrate SimplePatchTool to your app. You are also recommended to see Recommended Project Structure.
It is possible to create patches in a number of ways:
Use the Patcher create
command. It takes the following arguments:
- root: path of the up-to-date (latest) version of your application
- out: patch files will be generated here
- name: a unique name for your SimplePatchTool project. This name is used in several key locations, so give it a meaningful name with low collision chance and try not to change it after releasing the first version of your app. Name can only contain English letters and numbers
-
version: version code of the latest version of your app, e.g.
1.0
,0.4.11.3
and so on - prevRoot: (optional) path of the previous version of your application. Providing a prevRoot will create an incremental patch. If this is the first release of your app, don't use this argument
- ignoredPaths: (optional) path of a text file that stores paths of files/directories relative to the root path that SimplePatchTool should ignore. One ignored path per line
- dontCreateRepairPatch: (optional)(flag) as the name suggests, instructs SimplePatchTool to not generate a repair patch. Might be useful when e.g. you have created a patch from version 1.2 to 1.3 and now you want to create only an incremental patch that patches directly from version 1.1 to 1.3 (and not wait for SimplePatchTool to regenerate the same repair files)
- silent: (optional)(flag) progress will not be logged to the console
Example: Patcher create -root="C:\App v1.1" -prevRoot="C:\App v1.0" -version="1.1" -out="C:\Users\USERNAME\Desktop\PatchFiles" -name="MyProjectName"
Namespace: SimplePatchToolCore
public PatchCreator( string rootPath, string outputPath, string projectName, VersionCode version )
: creates a new PatchCreator instance. Its parameters correspond to the root, out, name and version arguments mentioned in the console app section. VersionCode supports implicit casting from string
PatchCreator LoadIgnoredPathsFromFile( string pathToIgnoredPathsList )
: corresponds to the ignoredPaths argument mentioned in the console app section
PatchCreator AddIgnoredPath( string ignoredPath )
: PatchCreator ignores the specified path
PatchCreator AddIgnoredPaths( IEnumerable<string> ignoredPaths )
: PatchCreator ignores the specified paths
PatchCreator CreateRepairPatch( bool value )
: sets whether or not a repair patch should be generated
PatchCreator CreateIncrementalPatch( bool value, string previousVersionRoot = null )
: sets whether or not an incremental patch should be generated. If value is equal to true, a previousVersionRoot must be provided (which corresponds to the prevRoot argument mentioned in the console app section)
PatchCreator SilentMode( bool silent )
: sets whether or not PatchCreator should log anything
bool Run()
: starts creating the patch asynchronously in a separate thread. This function will return false, if PatchCreator is already running
string FetchLog()
: fetches the next log that PatchCreator has generated. Returns null, if there is no log in the queue
void Cancel()
: cancels the operation
bool IsRunning { get; }
: returns true if PatchCreator is currently running
PatchResult Result { get; }
: returns PatchResult.Success if patch is created successfully, PatchResult.Failed otherwise. Its value should be checked after IsRunning returns false
Example code: SimplePatchToolConsoleApp.Program.CreatePatch
Open Window-Simple Patch Tool window and switch to the CREATE tab:
These parameters correspond to the root, prevRoot, out, name and version arguments mentioned in the console app section. Instead of providing the ignored paths via a text file, you should enter them directly to the Ignored paths field. By default, *output_log.txt
is ignored, which is the log file that Unity automatically generates.
Clicking the Create Patch button starts generating the patch asynchronously, whereas the Generate Console Command button outputs a console command that can be used to generate the patch via the console app.
When a patch is created, all the download links in the generated VersionInfo.info file will be blank and it will have only one <IncrementalPatch>
in it (or zero, if it is your first patch or you chose not to create an incremental patch). To address these issues, follow these steps:
- if your previous patch had any
<IncrementalPatch>
es in its VersionInfo, copy them to the newest VersionInfo - upload the patch files to the server of your choice
- update the download links in VersionInfo
- update the VersionInfo.info that you've initially uploaded to your server with the one on your computer that you've just updated
NOTE: after you create a patch, a file named {name}_vers.sptv
will automatically be created in root directory. This file simply stores the version of the application. This file is ignored by SimplePatchTool implicitly, so you don't have to add it to the ignored paths list.