Returning to TW after a break, I notice it still has ideosyncratic file-writing, what you're currently doing is backwards, as the result of lazy coding: MyFile, MyFile1...MyFileN. The headache you're causing is that there is no pointer to the current live file, so when a user reloads, he's reloading the outdated old copy. That's wrong, and was established as an incorrect protocol nigh on 50 years ago. I date back to the days when we were making fundamental decisions about the differentiation between instructions and data, in passing: my first coding was on the Lyons Leo, 20-column input cards (yes, that was before the 80-column ones, they had sprocket holes in the header strip).
The core logic is: 1. We have an existing file which is known to be "clean" 2. A copy is loaded, and the User changes something, making the live copy "dirty" 3. At that point, a set of choices are possible: - Drop the dirty - Keep working with the dirty - Save the dirty 4. Presuming the first two are irrelevant loops, I'll focus on 3. It's to be remembered that even the file index (directory, folder, whatever) is simply another file containing data about what's actually on disk somewhere: the name, the start point of the actual file, security settings, dates and times, etc etc etc. Old and New in this case are just labels, representing some unlknown file name. New is likely to be a temporary system-assigned string, which is linguistically incoherent, just a set of random characters which isn't already a filename. - While saving, for some microseconds the file copy is incomplete. Therefore, we don't want to overwrite Old (the Clean version) yet. - Once the New file write is complete and checked, we then have 2 Clean versions on disk, Old and New. - Old is RENAMEd in the Live copy of the index, not yet saved. - New is RENAMEd to its definitive name in the same. - Old may be deleted, if an archive history isn't being kept, returning its storage to the available pool. This is routine Operating System housekeeping. - The Index is saved, committing everything. Doing it this way, at no time is a clean copy absent from file. -- You received this message because you are subscribed to the Google Groups "TiddlyWikiDev" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at https://groups.google.com/group/tiddlywikidev. To view this discussion on the web visit https://groups.google.com/d/msgid/tiddlywikidev/defe992d-545e-4679-a4ce-4788f080dfbe%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
