I'm getting some strange behavior for restoring folderitems from the preferences. When the folderitem is there then all is well, but when I move the folderitem to the trash and then try to get the folderitem I get one of 2 behaviors:
1. Folderitem with correct absolute path, exists = false, native path = ""
2. Folderitem with lots of numbers in name and native path (not reproducable).
Here is the code that I use to get the folderitem. It hasn't changed in years.
Public Function getPrefFolderitem(fieldName as string) as Folderitem dim theCFPrefs as new CFPreferencesMBS Dim theCFObject As CFObjectMBS = theCFPrefs.CopyAppValue(NewCFStringMBS(fieldName), theCFPrefs.kCFPreferencesCurrentApplication) if theCFObject = Nil then Return nil dim theFolderitem as FolderItem if theCFObject.TypeDescription = "CFString" then dim FieldValue as String = CFStringMBS(theCFObject).str theFolderitem = Volume(0) dim theSaveInfo as String = DecodeBase64MBS(FieldValue) return theFolderitem.getRelative(theSaveInfo) end if End Function
Shouldn't the saveinfo show me that I moved the file to the trash? Why is the absolute path correct and the native path empty?
When I move a complete folder into the trash I get the correct folderitem pointing to the trash. When I move the file into the trash with 2016r4 I get at the correct native path.
When I do a simple test with
dim d as folderitem = specialfolder.desktop d = d.child("blabla")
then I get the correct native path.
Xojo 2017r1, MacOS 10.11.6.