Jump to content

How to know that a kNotifyDocPostSaved-Notification is triggered due to a backup in VW 2022


Recommended Posts

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.)

Link to comment
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

  • Like 2
Link to comment
Posted (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 by Nicolas Goutte
Link to comment

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...