LB Booster
Programming >> Liberty BASIC language >> File Versioning http://lbb.conforums.com/index.cgi?board=lblang&action=display&num=1446374347 File Versioning
Post by joker on Nov 1st, 2015, 09:39am
Is there an accessible place in a file (RAF in my case) that I can use to indicate a file's version?
I'm thinking that I may want to change the structure (FIELDs) in a file at some point. I want to add the check routine in the program from the start. I do realize that the first version doesn't need to check if the following versions maintain compatibility, but I'm not sure I'll be able to maintain compatibility. I'm thinking I'll have to provide an upgrade only sequence.
I used to do this by adding a FIELD in the file, but it was always a bit klunky doing it that way. I really don't want anything in my file that isn't data.
Surely there must be a better way by now.
Re: File Versioning
Post by Richard Russell on Nov 1st, 2015, 1:09pm
Modern filing systems do often support 'metadata' or 'alternate streams' which are stored independently of the file itself, but I would advise against using them because if you transfer your file to a different file system which doesn't support metadata (for example copy it onto a FAT-formatted USB stick or compress it in a ZIP archive) the version info may well be lost.
So if you want to keep the version info reliably, you will need to store it somewhere within the file (e.g. reserve the first record for that purpose). Although Liberty BASIC expects you to use the same field structure for every record, that is not enforced (at least, it is not enforced in LBB) so you could do a simple PRINT to (or INPUT from) the very beginning of the file so long as you can guarantee that (including the CRLF) it's not any bigger than the record length.
Richard. Re: File Versioning
Post by joker on Nov 1st, 2015, 2:14pm
Long story short, I got into the habit of including a "CRLF" FIELD at the end of every record in an RAF. (It was for accessing the file in a different way.)
Guess I'll just keep that up and, like you say, use the first record for "configuration" stuff.