Local Replica File Path (db.Filepath) & Trimming Extra Folder Info

Mindwatering Incorporated

Author: Tripp W Black

Created: 01/08/2004 at 10:47 AM

 

Category:
Notes Developer Tips
LotusScript

"A local database need not live within the confines of the data directory. For instance, using your example, the data
directory may be "c:\Program Files\Lotus\Notes\data", but a database could reside at d:\temp\fake.nsf. There is no
way to make that relative to the data directory.
You might want to try a more robust way of determining the relative path.
Possibly something like the example below."

Sub Initialize
Dim session As New NotesSession
Dim db As NotesDatabase
Set db = session.CurrentDatabase
Dim dataDir As String
Dim fullpath As String
Dim relpath As String
dataDir = session.GetEnvironmentString( "Directory", True )
fullpath = db.FilePath
If Instr(1,fullPath,dataDir,5)>0 Then
relpath = Mid$(fullPath, Len(dataDir)+2)
Else
relpath = fullPath
End If
End Sub


previous page