« REAL Studio and iOS | Home | Tips for extra days i… »

Tip of the day: Move file to trash, the right way

If you want to move a file to trash, you could use f.movefileto f.trashfolder, but that will overwrite existing files in the trash. You can use our MacFileOperationMBS class to move a file on Mac to the trash. And it uses the same code as the Finder, so files are renamed when the same name is already in use in the trash:
Sub MoveFileToTrash(f as FolderItem)

dim r as FolderItem
call MacFileOperationMBS.MoveObjectToTrashSync(f, r, MacFileOperationMBS.kFSFileOperationDefaultOptions)

End Sub
Requires Mac OS X 10.5. Used tags:
10 09 10 - 11:26