Matt has plans for the next few years: dealing with the "inheritance" of some legacy systems.
They're written in VB.Net, which isn't itself a problem, but the code quality leaves just a bit to be desired.
Dim FileInfo As New System.IO.FileInfo(FileName)
FileName = FileInfo.Name
If FileName = "" Then
Throw New ApplicationException("cannot determine the file name for '" & FileName & "'")
End If
I suspect they wanted to check if the file exists. Which is definitely a reasonable thing to want to check with aFileInfo
object, which is why it has an Exists
property which one could use. But this code doesn't accomplish the exists check- if the file doesn't exist, the Name
property is whatever name you used to construct the object. Perhaps they hoped to canonicalize the name, but that's also not a thing the Name
property does.
So, in practice, this code doesn't do anything, but boy, it looks like it might be an important check.