[quote=479264:@Richard Albrecht]I have following code:
lfile = GetFolderItem("MemberTree:MemberTree.mpkg:", 0)
This worked in previous version of Xojo[/quote]
As already mentioned by others - 2019r2+ won’t work properly any longer with old style Absolute Paths.
Another approach for your situation would be: Loop through the currently mounted Volumes using DriveAt, and see if there is a .Child("MemberTree.mpkg")
in there.
The bigger problem is those situations where you still have stored references as “Absolute Path”.
If you only have that and need to get the FolderItem with current Xojo Versions:
Var f1 As FolderItem = GetFolderItem("MemberTree:MemberTree.mpkg:", FolderItem.PathTypeAbsolute)
Var f2 As New FolderItem("MemberTree:MemberTree.mpkg:", FolderItem.PathTypeAbsolute)
Var g As FolderItem = GetFolderItemFromAbsolutePath("MemberTree:MemberTree.mpkg:")
f1 and f2 seem not to give the (previously expected) result any more. One could blame Xojo for breaking existing code that still compiles. So you have to write your own method of getting the correct FolderItem back when you only have an Absolute Path - g should work as it used to work before in older Xojo versions. Add this Method to a public Module:
[code]Public Function GetFolderItemFromAbsolutePath(psAbsolutePath As String) as FolderItem
Dim sNativePath As String
#If TargetMacOS Then
Declare Function CFURLCopyFileSystemPath Lib "Foundation" (anURL As Ptr, pathStyle As Int32) As CFStringRef
Declare Function CFURLCreateWithFileSystemPath Lib "Foundation" (CFURLCreateWithFileSystemPath As Ptr, filePath As CFStringRef, pathStyle As Int32) As Ptr
Const kCFURLPOSIXPathStyle = 0
Const kCFURLHFSPathStyle = 1
Dim ptrNSURL As Ptr = CFURLCreateWithFileSystemPath(nil, psAbsolutePath, kCFURLHFSPathStyle)
sNativePath = CFURLCopyFileSystemPath(ptrNSURL, kCFURLPOSIXPathStyle)
#Else
'Windows, Linux: NativePath is the same as Xojo’s deprecated AbsolutePath
sNativePath = psAbsolutePath
#EndIf
Return New FolderItem(sNativePath, FolderItem.PathTypeNative)
End Function[/code]
Again: in your situation - better do it some other way without using AbsolutePath’s.
The above Method will be helpful to still access previously saved “Absolute Path references”. From there, you’d better migrate to some other path format.