Jump to content
Neutro

Files patch manager v1.1 (patch generator)

Recommended Posts

Hey guys,

I needed a tool to generate a patch from the folder of a software after an update so i could apply this patch to other computers without having to re-download the update on them as well.

I've looked a bit on the net and was surprised not beeing able to find one. 

So i've made my own that i called "file patch manager":

Clipboard01.png.388bea5cb013b12ba9766665c5303097.png

I think the explaination in the screenshot above is pretty much straightfoward so i don't need to add a lot more to that :)

This is developped in pure autoit v3.3.14.5, no UDF required.

 

Download

Source code:    files patch manager v1.1.au3

Compiled exe:   files patch manager v1.1.exe

 

I've noticed that the compiled exe can sometimes be detected as a trojan by windows defender  :facepalm: But this is a false positive as it's a compiled exe from the untouched source code i'm providing here as well. If you have any doubt feel free to compile it yourself instead of directly using the exe, but i assure you the exe is completely safe. If i had bad intentions i wouldn't share the source code as well ;)

More informations on why the false positive happens can be found here: 

 

The code is not perfect and could certainly be enhanced but i've tested it and all the steps should work properly in all situations except maybe when using it on a folder that contains files with special attributes (explained below).

What could be enhanced:

 - if the updated version of the folder of the software contains empty folders that did not previously exist in the outdated folder, this tool doesn't carry them over (it could be added easily thought, i made a comment about that in the source code)

- i didn't test the tool with a folder that had files with special attributes (hidden, system, ect...) so some tweaking might be needed to use it on such a folder

- i didn't had the time to secure the tool properly from user-input mistakes or to add proper error handling to all the functions used to check they return values for errors, but you can easily check if the patch works correctly by trying to apply it to an outdated folder then compare it's byte size to the one of the updated folder. If they match then it's OK.

- the GUI design which is pretty basic but doing a fancy thing wasn't my goal here.

- when designing the engine to compare the outdated and updated folders i did one that compares the files then the folders. It compares them in 2 steps while it could have been possible to compare both in 1 step by analysing if the compared element was a file or a folder using the FileGetAttrib function.
This means that for a software that has a huge number of files and folders (over 10000) the 2 step process will take twice the time it would take with a 1 step process. But since i've never had to work in that case until now, i won't change the compare engine right now. If one of you reach this case and processing time is an essential factor you know what you have to do ;) Shouldn't be too complicated to make the change anyway if needed.

 

If you have any problems using it feel free to ask, i'll do my best to help when i'm available. If possible include the outdated and updated folders you use as the source of your patch so i can run it and check errors by myself as well.

 

If you used this tool for your own needs and made some improvements consider sharing your version as well ;)

 

Enjoy :)

 

Changelog

22 august 2019 - v1.0:

- initial release

23 august 2019 - v1.1:

- fix crash if patch generated has no file to delete inside the outdated folder.  

- added a progress bar to show which file the tool is currently working on, it's size and how many files are remaining so the tool doesn't look frozen when it's working with large files.

 

Edited by Neutro

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...