[openbeos] Re: Tracker scripting and related headers

  • From: "Michael Pfeiffer" <michael.pfeiffer@xxxxxxxxx>
  • To: openbeos@xxxxxxxxxxxxx
  • Date: Tue, 19 Dec 2006 15:16:04 +0100

Am 19.12.2006, 14:45 Uhr, schrieb :

It's also not that hard to write such a method directly:

status_t
move_to_trash(BEntry& entry)
{
        node_ref nodeRef;
        status_t status = entry.GetNodeRef(&nodeRef);
        if (status < B_OK)
                return status;

        char path[B_PATH_NAME_LENGTH];
        status = find_directory(B_TRASH_DIRECTORY, nodeRef.device, true,
                path, sizeof(path));
        if (status < B_OK)
                return status;

        BDirectory trash(path);
        status = trash.InitCheck();
        if (status < B_OK)
                return status;

        return entry.MoveTo(&trash);
}

IIRC the node in the trash contains an attribute that points to the folder where it originated from (used by restore/undelete).

Ciao,
Michael

Other related posts: