WWDC gotchas for Xojo developers?

@Norman Palardy : saving the preferences works fine. If try to read the folder then the folderitem always is nil. I’m going to upload a test project tomorrow.

not sure but in theory this code should reproduce this problem

Dim f As FolderItem = SelectFolder
Dim t As String = f.GetSaveInfo(Volume(0))

Dim s As String = EncodeBase64(f.GetSaveInfo(Volume(0)))

Dim FolderFromPrefs As FolderItem = Volume(0)
Dim theSaveInfo As String = DecodeBase64(s)
Dim newFolderFromPrefs As FolderItem = FolderFromPrefs.getRelative(theSaveInfo)

If f.NativePath <> newFolderFromPrefs.NativePath Then
  msgbox "DO NOT match"
else
  msgbox "match"
End If

the only thing that might be relevant is encodebase64 not using 0 but that just inserts linewraps that should decode properly

you might try

Dim s As String = EncodeBase64(f.GetSaveInfo(Volume(0)),0)

instead

I dont currently have this future macOS version installed anywhere so I cant test this for you

You might try something a lot simpler like

Dim f As FolderItem = SelectFolder
Dim t As String = f.GetSaveInfo(Volume(0))

Dim FolderFromPrefs As FolderItem = Volume(0)
Dim newFolderFromPrefs As FolderItem = FolderFromPrefs.getRelative(t)

If f.NativePath <> newFolderFromPrefs.NativePath Then
  msgbox "DO NOT match"
else
  msgbox "match"
End If

to see if the problem is just in recreating the folderitem from save info

that would be something Xojo would need to fix

Back in 2013, please find a hint in the Xojo Blog:

Since then, I’ve moved my preferences files to the new location, just to be save.

In the Sandbox world; if you try this it will fail as the application will lose it’s privileges to the file/folder. Apple recommend you use Security-Scoped Bodgemarks (sorry I threw up my breakfast); they are inherently bad due to time outs and incompatibility with Apple API, not to mention their incompatibility with every other database engine on the planet, apart from Apple’s own CoreData.

Is your application Sandboxed?, if not I wonder if they’ve decided to port this ‘security’ over to non-sandboxed applications.

There are two alternative solutions; which are a little weird but are more effective than SSBs.

  1. Use the correct API for storing recent documents, once you use the Apple Recent Items menu, your application will have unhindered access to those items.
  2. Use Window Restoration; and attach the folderitem as a NSDocument to the window. All the time you use this mechanism you have unhindered access to that folderitem (until that window is closed).

I have submitted several feature requests to Apple to create a better solution than SSBs, (I clearly list the reasons why and why each suggestion would maintain security, yet make prevent the fallout of the holes in SSBs). Each one has been rejected and so have my bug reports about the issues regarding SSBs.

As the beta is under NDA; I wait at least for the public beta in July before I add something publicly to my plugins for the new MacOS version.

I pretty much used the code from Norman:

[code]dim theFolder as FolderItem = SelectFolder
if theFolder = Nil then Return
dim SaveInfo as string = EncodeBase64(theFolder.GetSaveInfo(volume(0)))

dim NewFolder as FolderItem = Volume(0)
NewFolder = NewFolder.getRelative(DecodeBase64(SaveInfo))
if NewFolder = Nil then
MsgBox “nothing there”
else
MsgBox "folder: " + NewFolder.NativePath
end if[/code]

Quite simple, no preferences.

On High Sierra I get the "folder: " message. In Catalina I get “nothing there”. Not sure if this is a bug in Xojo or not. As for Xojo itself it just uses the NativePath so it’s not surprising that the preferences work fine.

@Sam Rowlands : urgh… After your enthusiastic description of the bookmarks I really hadn’t wanted to use them. I only have one folder I might need to use for the Sandboxed version. The non-Sanboxed version absolutely needs to save folders because it’s writing files into those folders. But simple NativePaths seem to work fine.

dim NewFolder as FolderItem = Volume(0)

Do you have the right to write there ? And under Cataline ?

I’ve tried this on 10.15 and GetRelative fails regardless of what mode the saveinfo was created
I’ve tried all three modes and in my code

Dim newFolderFromPrefs As FolderItem = FolderFromPrefs.getRelative(theSaveInfo)

always fails and returns NIL every time

The saveinfo seems to be created ok (its hard to know since it is binary data that I dont know the internals of) but the saveinfo is not empty or nil

So it’s a bug in Xojo?

Maybe the old code to resolve alias files is broken in 10.15?

would seem to be

Okay, here we go: http://feedback.xojo.com/case/55977

Use copy sharing link instead of HTTP link as its not clickable in the forum
<https://xojo.com/issue/55977>

Add these two macOS 10.15 issues with Xojo:

SpecialFolder.Trash and GetFolderItem are broken.

<https://xojo.com/issue/55979>

<https://xojo.com/issue/55980>

Before everyone starts getting angry with Apple or Xojo, I’ve had a discussion with my developer liaison about a few deep issues in this macOS developer release, and while I can’t disclose the issues discussed, I can pass on that we should hold off on making changes to our apps for any issues that we are witnessing in our apps or tools (including Xcode) until the first public BETA is pushed.

They do want us to report to them (Apple) on security and filesystem access issues, but there will be some pretty hefty modifications between what we are seeing versus what will be in that first public access push.

Thanks Tim for relaying this information.

Correct.

@Time Jones: even for Apple this is beyond stupid. How can I report on issues when I don’t know what they are going to change?

Tiny ‘gotcha’ for English(UK) users of 10.15. The ‘Trash’ has been renamed ‘Bin’. So now when deleting a file/s or folder/s the menu entry reads “Move to Bin”. My first thought why do I want to move a deleted file to the ‘/bin’ folder! :slight_smile:

The ‘bucket’ on the app bar thing is now labelled ‘Bin’ and right-clicking shows “Empty Bin”. That might worry people for a second or two for the same reason as above! :slight_smile:

I’m assuming this is a recent renaming of ‘Trash’ to ‘Bin’ since my 10.14.6 (which also uses English(UK)) has a ‘Trash’ can.

‘Rubbish’ might have been a more apt term. Probably has too many letters though :slight_smile:

I thought you were joking but I’ve just checked and sadly you weren’t. Yuck! I’ll stick to US region settings now.