Tip of day: Move file/folder to trash
Shared Function MoveFileToTrash(f as FolderItem) As Boolean
#if TargetMacOS then
dim r as FolderItem
dim e as integer = MacFileOperationMBS.MoveObjectToTrashSync(f, r, MacFileOperationMBS.kFSFileOperationDefaultOptions)
if e = 0 then
Return true // Ok
end if
#elseif TargetWin32 then
dim w as new WindowsFileCopyMBS
dim flags as integer = w.FileOperationAllowUndo + w.FileOperationNoErrorUI + w.FileOperationSilent + w.FileOperationNoConfirmation
if w.FileOperationDelete(f, flags) then
Return true // OK
end if
#else
// Target not supported
break
Return false
#endif
End Sub