Skip to content

Commit

Permalink
Log warning for UNC path access errors
Browse files Browse the repository at this point in the history
Failing to convert a path to UNC may not prevent the operation from completing, but it should be handled and logged. Fixes joyfullservice#461
  • Loading branch information
joyfullservice committed Nov 17, 2023
1 parent 8776104 commit 64a14de
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion Version Control.accda.src/modules/modFileAccess.bas
Original file line number Diff line number Diff line change
Expand Up @@ -530,11 +530,14 @@ End Function
' Purpose : Returns the UNC path for a network location (if applicable)
'---------------------------------------------------------------------------------------
'
Public Function GetUncPath(strPath As String)
Public Function GetUncPath(strPath As String) As String

Dim strDrive As String
Dim strUNC As String

LogUnhandledErrors
On Error Resume Next

strUNC = strPath
strDrive = FSO.GetDriveName(strPath)
If strDrive <> vbNullString Then
Expand All @@ -544,6 +547,11 @@ Public Function GetUncPath(strPath As String)
End If
End With
End If

' Log warning if unable to access a drive.
CatchAny eelWarning, "Unable to determine UNC path for " & strPath, ModuleName & ".GetUncPath"

' Return UNC Path
GetUncPath = strUNC

End Function
Expand Down

0 comments on commit 64a14de

Please sign in to comment.