savetiddlers
savetiddlers copied to clipboard
doesn't create a backup in tiddlywikilocations/twbackup
I think for a while my mGSD (a TiddlyWiki variant with features) has not been creating backups in ~/Downloads/tiddlywikilocations/twbackup.
I stepped through it and think I see the problem.
saveBackup
calls saveFile
calls injectedSaveFile
(from the extension) and then the event handler messageBox.addEventListener("tiddlyfox-save-file", ...
handles the message. But the event handler, instead of getting the path from the "data-tiddlyfox-path"
message attribute, at line 92 in contentscript.js) sets path = currentlocation()
which gets it from window.location
, and in the result in my case is it saves the file and the backup to the same file path.
I think the fix is just to change that one line to
path = message.getAttribute("data-tiddlyfox-path");
I'll attempt a pull request.
Hi @skierpage, savetiddlers was designed, in the first instance, to work with tw5, and tw5 does not have a backup mechanism. Thus savetiddlers can automatically create a backup (in the case of tw5 this is the default, but is disable by default for twc). There is a checkbox in the addon settings to enable backups for twc, and a box to set the backup directory. I would advise using this method of backups and disable the creation of backups from within your tiddlywikis.
Note that there is a new version as of yesterday that fixes another issue.
Thanks for the tip! Nevertheless the code is broken; it sets attribute "data-tiddlyfox-path" but never uses it.