DeleteFiles

Far Manager

DeleteFiles

The DeleteFiles function is called to delete files in the file system emulated by the plugin.
(FAR to plugin: "this file(s) from your panel need to be deleted").
int WINAPI DeleteFiles(
  HANDLE hPlugin,
  struct PluginPanelItem *PanelItem,
  int ItemsNumber,
  int OpMode
);

Parameters

hPlugin
Plugin handle returned by OpenPlugin or OpenFilePlugin.
PanelItem
Points to an array of PluginPanelItem structures. Each structure describes a file to delete.
ItemsNumber
Number of elements in the PanelItem array.
OpMode
Combination of the operation mode flags. This function should process the flag OPM_SILENT.

Return value

If the function succeeds, the return value must be TRUE. If the function fails, FALSE should be returned.

Remarks

  1. The plugin should process "its folders" by itself.
  2. It is considered a good form of behaviour to inquire the user about his/her intensions (see also ACTL_GETCONFIRMATIONS, flags FCS_DELETE and FCS_DELETENONEMPTYFOLDERS)

Example

int WINAPI DeleteFiles(HANDLE hPlugin, PluginPanelItem *PanelItem,
           int ItemsNumber,int OpMode)
{
  struct PluginPanelItem * curPI=&PanelItem[0];
  for(int CurItem=0;
      CurItem<ItemsNumber;CurItem++,
      curPI++)
  {
    char* aFile=curPI->FindData.cFileName;
    if(!RemoveFileFromFS(aFile))
    {
      char *MsgItems[]={"Delete failed","","OK"};
      MsgItems[1] = GetErrorStringFS();
      Message(MyNumber,0,NULL,MsgItems,
              sizeof(MsgItems)/sizeof(MsgItems[0]),1);
      return(FALSE);
    }
  }
  return(TRUE);
}