Skip to content

Commit

Permalink
Always return a value when trying to build a relative path
Browse files Browse the repository at this point in the history
Returning an empty string could cause problems in certain situations. See #55
  • Loading branch information
joyfullservice committed Jul 15, 2020
1 parent 6854314 commit b7f6f1e
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 3 deletions.
2 changes: 1 addition & 1 deletion Version Control.accda.src/modules/clsDbProjProperty.bas
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ Private Sub IDbComponent_Export()
Case "AppIcon"
' Try to use a relative path
strPath = GetRelativePath(CStr(prp.Value))
If Len(strPath) > 0 Then
If Left(strPath, 4) = "rel:" Then
varValue = strPath
Else
' The full path may contain sensitive info. Encrypt the path but not the file name.
Expand Down
2 changes: 1 addition & 1 deletion Version Control.accda.src/modules/clsDbProperty.bas
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ Private Sub IDbComponent_Export()
If Len(varValue) > 0 Then
' Try to use a relative path
strPath = GetRelativePath(CStr(varValue))
If Len(strPath) > 0 Then
If Left(strPath, 4) = "rel:" Then
varValue = strPath
Else
' The full path may contain sensitive info. Secure the path but not the file name.
Expand Down
5 changes: 4 additions & 1 deletion Version Control.accda.src/modules/modFunctions.bas
Original file line number Diff line number Diff line change
Expand Up @@ -2032,7 +2032,7 @@ End Sub
' Author : Adam Waller
' Date : 5/11/2020
' Purpose : Returns a path relative to current database.
' : If a relative path is not possible, it returns an empty string
' : If a relative path is not possible, it returns the original full path.
'---------------------------------------------------------------------------------------
'
Public Function GetRelativePath(strPath As String) As String
Expand All @@ -2044,6 +2044,9 @@ Public Function GetRelativePath(strPath As String) As String
If InStr(1, strPath, strFolder, vbTextCompare) = 1 Then
' In export folder or subfolder. Simple replacement
GetRelativePath = "rel:" & Mid$(strPath, Len(strFolder) + 1)
Else
' Return original full path.
GetRelativePath = strPath
End If

End Function
Expand Down

0 comments on commit b7f6f1e

Please sign in to comment.