]> git.lyx.org Git - lyx.git/blobdiff - development/Win32/pdfview/pdfview.nsi
quit when PDF file no longer exists
[lyx.git] / development / Win32 / pdfview / pdfview.nsi
index fe99159cde9baad94652424dcf83bffa56f533fd..a30e9dfa84f677171964cafa2c189b211814c4b5 100644 (file)
@@ -155,10 +155,17 @@ Section "View PDF file"
     ${Do}
     
       !insertmacro SystemCall "kernel32::WaitForSingleObject(i $ChangeNotification, i 10000) i.s"
-      Pop $WaitReturn    
-         
-      # Check whether a lock is still active.
-      # If not, Adode Reader is closed and we can close this application as well
+      Pop $WaitReturn
+      
+      # Check whether the PDF still exists (if not, LyX is being closed)
+      
+      ${IfNot} ${FileExists} $LockedFile
+        # Quit this application
+        !insertmacro SystemCall "kernel32::FindCloseChangeNotification(i $ChangeNotification)"
+        Quit
+      ${EndIf}
+      
+      # Check whether the lock is still active (if not, Adobe Reader being closed)
       
       FileOpen $LockedFile $PDFFile a