feat: add shell.trashItem() to replace shell.moveItemToTrash() (#25114)
This commit is contained in:
parent
e9e7eee25e
commit
1b6534b326
11 changed files with 212 additions and 21 deletions
|
@ -19,6 +19,7 @@
|
|||
#include "dbus/bus.h"
|
||||
#include "dbus/message.h"
|
||||
#include "dbus/object_proxy.h"
|
||||
#include "shell/common/platform_util_internal.h"
|
||||
#include "ui/gtk/gtk_util.h"
|
||||
#include "url/gurl.h"
|
||||
|
||||
|
@ -220,6 +221,19 @@ bool MoveItemToTrash(const base::FilePath& full_path, bool delete_on_fail) {
|
|||
return XDGUtil(argv, base::FilePath(), true, platform_util::OpenCallback());
|
||||
}
|
||||
|
||||
namespace internal {
|
||||
|
||||
bool PlatformTrashItem(const base::FilePath& full_path, std::string* error) {
|
||||
if (!MoveItemToTrash(full_path, false)) {
|
||||
// TODO(nornagon): at least include the exit code?
|
||||
*error = "Failed to move item to trash";
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
} // namespace internal
|
||||
|
||||
void Beep() {
|
||||
// echo '\a' > /dev/console
|
||||
FILE* fp = fopen("/dev/console", "a");
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue