Other What is the best way to restore from auto backup ?

AnandGupta

Expert
Licensed User
Longtime User
I am working on a B4XPages project. Mostly B4A. Auto backup works. Fine.

I made a mess of the code and remember that earlier code worked.
Now I want to restore the earlier set of codes, i.e. remove the new .bas, reset codes in old .bas etc.

So, what is the best way to restore from auto backup ?

Now I do it manually and it is time consuming as "B4XMainPage.bas" etc. are in B4A folder in the zip file. Please guide.

Regards,

Anand
 

Jorge M A

Well-Known Member
Licensed User
You might want to unpack the backup in an alternate folder and use a tool like WinMerge to do the code comparison and at the same time update the source files.


 
Upvote 0

MikeSW17

Active Member
Licensed User
So nnpack the zip elsewhere - but I don't see why either way is 'time consuming', for most purposes, Zip files are just treated as folders (in Windows at least).

Also, for possible future use, Windows File History is quite useful if you add your development folders to the History.
 
Upvote 0

AnandGupta

Expert
Licensed User
Longtime User
Let me explain my problem with an image of the compare of project folder and zip extracted folder.
In the below image the left side is project folder and right side is zip extracted folder.
b4a2.png

(This is a very small project I have taken to explain the problem)
Now you can see that the B4XMainPage.bas and all the .bas files (not in this small project) which are shared with B4A and B4J, are in the B4A folder in the zip file. So these files do not match correspondingly.

This makes comparing time consuming, as each main folder .bas file is needed to be compared individually.

Regards,

Anand
 
Upvote 0

MikeSW17

Active Member
Licensed User
Ok, I see. It does make it awkward. Seems to be a bug in a sense as you cannot simply restore an auto-backup to revert exactly to a previous state without manual intervention.
I would have expected the whole project structure to be zipped/unzipped identically.
 
Upvote 0

JordiCP

Expert
Licensed User
Longtime User
Let me explain my problem with an image of the compare of project folder and zip extracted folder.
In the below image the left side is project folder and right side is zip extracted folder.
b4a2.png
There's 'manual' a way, with 7zip command line, to "fix" the autobackups for this purpose --> It could be possibly automated with a batch file, so you'll only have to execute it before comparing

Download 7zip, install it and add it to your PATH. Start cmd.exe in the Autobackups folder. The executed commands for a given "myzipfile.zip" would be

B4X:
del *.bas                                                                           Delete existing .bas files in the working dir
7z -e myzipfle.zip B4A/*.bas -r-                                     Will extract all *.bas from the zipped file B4A folder, non-recursively
7z -d myzifile.zip B4A/*.bas -r-                                     Will delete all *.bas files from the zipped file B4A folder, non-recursively
7z -a myzipfile.zip *.bas                                                  Add the extracted files to the zipped file root folder
Since initially, in the zipped files, the shared files will be mixed with the not-shared, above wildcards won't work. Instead, for existing backups, the batch file should perform these operations on the individual files that are shared. Or, if all the shared files have a common prefix or sufix, change the wildcard accordingly (for instance *shared.bas)
 
Upvote 0

AnandGupta

Expert
Licensed User
Longtime User
Upvote 0

Alessandro71

Well-Known Member
Licensed User
Longtime User
The autobackup feature is clearly a child of the old, monoproject era: your files are saved, but your project will be messed up.
Count me on your Wish request.
 
Upvote 0

AnandGupta

Expert
Licensed User
Longtime User
Upvote 0
Top