Quote:
Originally Posted by BeckyEbook
I need one more thing: how to detect (via the plugin) if the file has been modified but not saved (exist * after filename).
|
Quote:
Originally Posted by DiapDealer
It's probably best to create modified flags for yourself in your plugin. Whether that's by setting flags whenever you know that your plugin has modified a file, or by gathering a list of some sort of file checksums before processing and then comparing those files checksums before exiting.
Plugins work on copies of files. Meaning changes aren't incorporated into the existing plugin until after the plugin completes.
There are some dictionaries in wrapper.py that can be accessed with that info, but that's considered bad form (somewhat) since unforeseen things can happen if those dictionary contents are accidentally modified incorrectly.
|
it occurs to me that I may have misunderstood your question. If you're asking if there's a way for plugins to know which of an epub's files are changed-but-unsaved
before the plugin took control, I'm afraid the answer is no. Plugins simply get copies of an epub's contents in their current state. There is no regard whatsoever for whether or not the epub is in an unsaved state.
It occurs to me, however, that it may be a good idea for there to be such info passed to plugins. Maybe not at the individual file level, but I think there probably
should be a way for a plugin to request/warn that an epub is in and unsaved state before continuing. I'm thinking of output/input plugins especially. With Kevin's new FolderOut plugin for instance, silently saving an OEBPS copy of an unsaved epub might cause unnecessary confusion.