File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -948,21 +948,27 @@ End Function
948948
949949'Helper function to construct correctly formatted filename
950950Function GetSnkFilename(srcFilename As String, type As String) As String
951- Dim hasFE As Boolean = HasFileExtension(srcFilename)
952- If SnkIsNative And hasFE And Not GetExtension(type) = "" Then 'Cut off file extension, if present
951+ Dim currentFE As String = GetFileNameExtension(srcFilename)
952+
953+ If SnkIsNative And (GetExtension(type) = currentFE) and currentFE <> "" Then 'Cut off file extension, if present
953954 srcFilename = RemoveFileExtension(srcFilename)
954955
955- ElseIf Not SnkIsNative And Not hasFE Then 'Add file extension, if not present
956+ ElseIf Not SnkIsNative And currentFE = "" Then 'Add file extension, if not present
956957 srcFilename = srcFilename + GetExtension(type)
957958 End If
958959
959960 Return srcFilename
960961End Function
961962
962963'Helper
963- Function HasFileExtension(filename As String) As Boolean
964- Dim index As Integer = filename.LastIndexOf(".")
965- Return index >= 0 And filename.Length - index <= 5
964+ Function GetFileNameExtension(filename As String) As String
965+ Dim index as Integer = -1
966+ index = filename.LastIndexOf(".")
967+ If index > 0
968+ Return filename.Substring(index)
969+ Else
970+ Return ""
971+ End If
966972End Function
967973
968974'Helper
You can’t perform that action at this time.
0 commit comments