fix lock on tmpbuf directory

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/branches/BRANCH_1_5_X@24486 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Joost Verburg 2008-04-24 10:52:24 +00:00
parent 46292d462a
commit 86824e189a

View File

@ -113,7 +113,8 @@ Section "View PDF file"
GetFullPathName $OriginalFile $OriginalFile GetFullPathName $OriginalFile $OriginalFile
${GetFileName} $OriginalFile $OriginalFileName ${GetFileName} $OriginalFile $OriginalFileName
${GetParent} $OriginalFile $OriginalDir ${GetParent} $OriginalFile $OriginalDir # tmpbuf
${GetParent} $OriginalDir $OriginalDir # tmpdir
SetOutPath $TEMP # The LyX tmpbuf should not be locked SetOutPath $TEMP # The LyX tmpbuf should not be locked
@ -149,7 +150,7 @@ Section "View PDF file"
# Monitor for updates of the original file # Monitor for updates of the original file
GetFileTime $OriginalFile $OriginalTimeHigh $OriginalTimeLow GetFileTime $OriginalFile $OriginalTimeHigh $OriginalTimeLow
!insertmacro SystemCall "kernel32::FindFirstChangeNotification(t '$OriginalDir', \ !insertmacro SystemCall "kernel32::FindFirstChangeNotification(t '$OriginalDir', \
i 0, i ${FILE_NOTIFY_CHANGE_LAST_WRITE}) i.s" i 1, i ${FILE_NOTIFY_CHANGE_LAST_WRITE}) i.s"
Pop $ChangeNotification Pop $ChangeNotification
${Do} ${Do}
@ -157,15 +158,7 @@ Section "View PDF file"
!insertmacro SystemCall "kernel32::WaitForSingleObject(i $ChangeNotification, i 10000) i.s" !insertmacro SystemCall "kernel32::WaitForSingleObject(i $ChangeNotification, i 10000) i.s"
Pop $WaitReturn Pop $WaitReturn
# Check whether the PDF still exists (if not, LyX is being closed) # Check whether the lock is still active (if not, Adobe Reader is 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 FileOpen $LockedFile $PDFFile a
@ -178,13 +171,14 @@ Section "View PDF file"
${EndIf} ${EndIf}
${IfNot} $WaitReturn = ${WAIT_TIMEOUT} ${IfNot} $WaitReturn = ${WAIT_TIMEOUT}
# The LyX tmpbuf has been updated
# The LyX temporary directory has been updated
# Check whether it's the PDF file that has been updated # Check whether it's the PDF file that has been updated
GetFileTime $OriginalFile $CurrentTimeHigh $CurrentTimeLow GetFileTime $OriginalFile $CurrentTimeHigh $CurrentTimeLow
${if} $OriginalTimeHigh != $CurrentTimeHigh ${If} $OriginalTimeHigh != $CurrentTimeHigh
${orif} $OriginalTimeLow != $CurrentTimeLow ${OrIf} $OriginalTimeLow != $CurrentTimeLow
# PDF has been modified, update view # PDF has been modified, update view
!insertmacro HideConsole '"$EXEDIR\pdfclose.exe" --file "$PDFFile"' !insertmacro HideConsole '"$EXEDIR\pdfclose.exe" --file "$PDFFile"'
CopyFiles /SILENT $OriginalFile $PDFFile CopyFiles /SILENT $OriginalFile $PDFFile