Quote:
> It doesn't. Setup must be checking the file's date stamp and/or file size.
> --
I found the Function in Setup1 which seems to be responsible. It checks for
file version, but if non it'll check for date stamp. But I'm sure the file I
was installing had a later date stamp than the one already existing. The
dialog was showing not a version number, but just double quotes (") for both
files. So I think this function evaluated that there was version
information, but that this information was the same on both files. Not very
intelligent, as also the file sizes are significantly different.
Here's the function from the module (basSetup1).
'-----------------------------------------------------------
' FUNCTION: SourceFileIsNewer
'
' Determines whether a file to be installed is newer than an
' existing file already on the system.
'
' IN: [sFile] - structure containing information about the source file
' [strSrcName] - name of source file
' [strSrcDir] - location of source file
' [strDestName] - name of destination file
' [strDestDir] - destination directory for file
' OUT: [strDestVer] - a string representing the version of the destination
file
'
' Returns: True if there is no existing (destination) file.
' True if the destination file does exist and the
' source file has a newer version.
' True if the destination file does exist but one
' or both files does not have version information
' and the source file has a newer timestamp.
' False otherwise
'-----------------------------------------------------------
'
Private Function SourceFileIsNewer(sFile As FILEINFO, strSrcName As String,
strSrcDir As String, strDestName As String, strDestDir As String, ByRef
strDestVer As String) As FileComparison
Dim fSrcVer As Boolean
Dim sSrcVerInfo As VERINFO
Dim fRemoteReg As Boolean
Dim sDestVerInfo As VERINFO
Dim datDest As Date
'
'The stuff below tries to save some time by pre-checking whether a file
'should be installed before VerInstallFile does its thing.
'Basically, if both files have version numbers, they are compared.
'Otherwise, we compare date.
'
On Error Resume Next
strDestVer = vbNullString
'
'Always attempt to get the source file version number. If the setup
'info file did not contain a version number (sSrcVerInfo.nMSHi =
'gintNOVERINFO), we attempt to read the version number from the source
'file.
'
fSrcVer = True
sSrcVerInfo = sFile.sVerInfo
If sSrcVerInfo.FileVerPart1 = gintNOVERINFO Then
fSrcVer = GetFileVerStruct(strSrcDir & strSrcName, sSrcVerInfo)
End If
'
'If there is an existing destination file with version information, then
'compare its version number to the source file version number.
'
If fSrcVer Then
fRemoteReg = (UCase$(sFile.strRegister) = mstrREMOTEREGISTER)
'mstrREMOTEREGISTER is uppercase
If GetFileVerStruct(strDestDir & strDestName, sDestVerInfo,
fRemoteReg) Then
With sDestVerInfo
strDestVer = CStr(.FileVerPart1) & "." & _
CStr(.FileVerPart2) & "." & _
CStr(.FileVerPart3) & "." & _
CStr(.FileVerPart4)
End With
'Both source and destinations have versions. Compare them.
SourceFileIsNewer = IsNewerVer(sSrcVerInfo, sDestVerInfo)
Err.Clear
Exit Function
End If
End If
'
'Since neither file has a version, the best we can do is compare dates.
'
Err.Clear
datDest = FileDateTime(strDestDir & strDestName)
If Err.Number = 0 Then
If sFile.varDate < datDest Then
SourceFileIsNewer = fcNewer
ElseIf sFile.varDate = datDest Then
SourceFileIsNewer = fcEquivalent
Else
SourceFileIsNewer = fcOlder
End If
Else
'Evidently the destination file does not exist. Therefore the source
' file should be copied and can be considered newer.
SourceFileIsNewer = fcNewer
End If
Err.Clear
End Function