To move a file to the Trash, do I use FolderItem.MoveFileTo, or is there a special method that should be used?
in MBS Plugins, the MacFileOperationMBS class does it for Mac.
On Windows, the WindowsFileCopyMBS class will do it.
What about folderitem.delete?
Delete function will delete the file right away.
on my program, i create htm and pdf when i create reports and it the file is already there, i delete them first. But sometimes, it doesn’t allow me to delete and i have to put the file to trash.
SUB DoDeleteOrTrash(vFileName as String)
dim f1 as FolderItem , x as Boolean
IF f1<>nil and f1.Exists THEN
if f1.LastErrorCode>0 then
SUB MoveToTrash(f as FolderItem) as boolean
#if TargetMacOS then
dim r as FolderItem
dim n as integer = MacFileOperationMBS.MoveObjectToTrashSync(f, r, _
if n = 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