moveObjectToTrash when trash folder not supported

I’m using macFileOperationsMBS.moveObjectToTrash but on particular drives it returns a -120 error - “directory not found”.

I’m assuming that it is because the drive (its a shared drive on a mac server) doesn’t support trash - but I may be wrong.

So 2 questions:

  1. How can I detect if a drive supports trash? (I’ve tried MBS’s folderItem extensions and volumeInformationMBS but don’t see anything relevant).
  2. How can I delete a folderItem immediately, without sending to trash?

you can use folderitem.delete to delete.

From the docs:

If the method returns an error, then present a dialog to the user saying that the item will be deleted immediately and then use FolderItem.Delete

Christian/Jared - thanks - that’ll do it.

It looks like there used to be a folderItem.trashFolder property but it appears to have been deprecated in favour of SpecialFolder.Trash. The challenge is that the latter refers to the user’s trash folder, whereas the former refers to the volume’s trash folder which would be the one I want to refer to.

Since I had a series of async file moves to do, I couldn’t ask the user on a case by case by basis as suggested.

For the record, what I did was to do a test deletion using MacFileOperationMBS.MoveObjectToTrashSync.

This allowed me to confirm that there was a trash file available before continuing the operation.