FolderItem crashes in macOS 10.15

The below code returns NIL for the FolderItem in macOS 10.15
Works in every older macOS version.

Any clues how to get all FolderItems in the Trash?

dim a as FolderItem a = SpecialFolder.Trash(Volume(0)) MsgBox str( a.Count ) MsgBox a.Item(0).NativePath

Try now, it should work. Although in Xojo19r11 I get a.count = 3 and in 19r21 I get a.count = 0

dim a as FolderItem a = SpecialFolder.Trash if a <> nil and a.exists then if a.count >= 0 then MsgBox str(a.Count ) MsgBox a.NativePath end if else msgbox "No such folder." end if

Before you try to get the path of an item, make sure it’s not nil, I don’t recall when this happened (some time ago) but I always forget and them bamb it hits me again at some point.

if a.item( 0 ) <> nil then MsgBox a.Item(0).NativePath

[quote=479474:@Carlo Rubini]Try now, it should work. Although in Xojo19r11 I get a.count = 3 and in 19r21 I get a.count = 0

dim a as FolderItem a = SpecialFolder.Trash if a <> nil and a.exists then if a.count >= 0 then MsgBox str(a.Count ) MsgBox a.NativePath end if else msgbox "No such folder." end if[/quote]

Try getting the folderitems of the files in the trash. It always returns nil.
Vey odd.

This always crashes

dim a as FolderItem a = SpecialFolder.Trash if a.Item(0) <> nil then MsgBox a.Item(0).NativePath

Very odd…

Have you tried using For Each… instead of looping through an index?

So are hacker kids looking for bank statements. Apple may be preventing you from this for user security reasons.

Odd answer and statement.
Anyhow, using Swift you can read (not change) the files in the trash. It just doesn’t work with Xojo.
So macOS does allow to read which files are in the trash.

Sorry, I was just thinking about all the new security stuff in Catalina and thought that might be part of the issue. One of the tricks I use for figuring out if something might be blocked because of security is to ask myself “How might this be used by someone with poor intentions?” I find a lot of answers in that question.

[quote=480075:@Christoph De Vocht]Anyhow, using Swift you can read (not change) the files in the trash. It just doesn’t work with Xojo.
So macOS does allow to read which files are in the trash.[/quote]
This is valuable information that should be added to a feedback ticket. This indicates that my hunch about security wasn’t the cause of your issue! If you make (or have made) a ticket, please share it here I’d be curious to follow along.