« xDev Magazine Issue 1… | Home | MBS Xojo / Real Studi… »

Tip of day: Move file/folder to trash

For Mac OS X and Windows using MBS Plugin functions:
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
The biggest plugin in space...
04 09 13 - 22:04