Nicolas Goutte Posted June 1, 2022 Share Posted June 1, 2022 VW 2022 seems to have changed its behavior and sends the kNotifyDocPostSaved notification, when a backup is made. So my question is: how do I know that the current kNotifyDocPostSaved is due to backup and not due to a regular saving. (I have to do things when the file is saved normally, but not when it is saved as a backup.) Quote Link to comment
Nicolas Goutte Posted June 2, 2022 Author Share Posted June 2, 2022 Using ISDK::GetActiveDocument is no help either, as it still gives the real path of the document, not the one currently used to save. (Tested on Windows) Quote Link to comment
JHangstoerfer Posted June 3, 2022 Share Posted June 3, 2022 On 6/1/2022 at 4:43 PM, Nicolas Goutte said: VW 2022 seems to have changed its behavior and sends the kNotifyDocPostSaved notification, when a backup is made. So my question is: how do I know that the current kNotifyDocPostSaved is due to backup and not due to a regular saving. (I have to do things when the file is saved normally, but not when it is saved as a backup.) kNotifyDocPreSaved seems to have the information you want // Manual kNotifyDocPreSaved C:\Users\Work\AppData\Local\Temp\Untitled 1-VWTMP.swap kNotifyDocPostSaved C:\tmp\Untitled 1.vwx // Backup kNotifyDocPreSaved C:\tmp\VW Backup\Untitled 1-Backup-20220603201902.vwx kNotifyDocPostSaved C:\tmp\Untitled 1.vwx Note that I used gSDK->GetOpenFilesList to read the filepath of the doc during the event, I don't know whether gSDK->GetActiveDocument provides the same information 2 Quote Link to comment
Nicolas Goutte Posted June 8, 2022 Author Share Posted June 8, 2022 (edited) OK, the trick seems to be that in PreSave a .swap is triggered on PreSave when the file is about to be overwritten. (Normal "Save" or Autosave on the same file) A .vwx in the other cases. "Save As" (or "Save" with dialog) can be catch by checking the path during PreSave and PostSaved: it is then the same (unlike for "Save Copy As", where it is different) An Autosave on Backup will have no .swap file in PreSave and its path is also different in PreSave than in PostSaved. (I think that these are all relevant cases. It was rather hard to find out.) PS.: all paths are get by ISDK::GetActiveDocument Edited June 8, 2022 by Nicolas Goutte Quote Link to comment
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.