How to write Absolute Path to File

I have this code and it allows me to select a folder on hard disk and I believe puts the whole path in a variable. But how do I write that info to a file on my hard disk? It will be a file the application will go to to get the path it must follow to open and read some data files once the app is running. I believe ‘Racedatapath’ holds the path to the selected folder where the race data files are located…

Dim Racedatapath As New FolderItem
Dim dlg as New SelectFolderDialog
Dim f as FolderItem
dlg.Title=“Select Data Path”
dlg.PromptText=“Prompt Text”
#If Not (TargetLinux) then
#Else //open Home directory on linux
If f <> Nil then
Racedatapath = f//use the folderitem here
//user cancelled
end if

Thanks Milfredo

RaceDataPath holds as reference to the folderitem. It is not the path to the file. Try

dim Racedatapath as string
Racedatapath = f.NativePath

Thanks Tim.