From 8c0d307dcb4cccfb15f32579cd5ff9857602a201 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois=20Revol?= Date: Sun, 19 Dec 2004 00:25:04 +0000 Subject: [PATCH] don't use system("hey") but the Clean Way(tm). git-svn-id: file:///srv/svn/repos/haiku/trunk/current@10489 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/apps/bin/trash.cpp | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/apps/bin/trash.cpp b/src/apps/bin/trash.cpp index a9c81f9275..670cc2b033 100644 --- a/src/apps/bin/trash.cpp +++ b/src/apps/bin/trash.cpp @@ -7,6 +7,8 @@ #include #include #include +#include +#include #include #include #include @@ -17,6 +19,7 @@ #include static const char *kAttrOriginalPath = "_trk/original_path"; +static const char *kTrackerSig = "application/x-vnd.Be-TRAK"; int usage(int ret) { @@ -114,8 +117,14 @@ int main(int argc, char **argv) return usage(0); if (!dountrash && !strcmp(argv[1], "--empty")) { /* XXX: clean that */ - if (system("hey Tracker delete Trash")) + BMessage msg(B_DELETE_PROPERTY); + msg.AddSpecifier("Trash"); + BMessenger msgr(kTrackerSig); + err = msgr.SendMessage(&msg); + if (err < 0) { + fprintf(stderr, "Emptying Trash: %s\n", strerror(err)); return 1; + } return 0; } if (dountrash && !strcmp(argv[1], "--all")) {