From 22920adf3e0a761a7dcc9005a2974c5a87d5f12b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stephan=20A=C3=9Fmus?= Date: Sat, 21 Mar 2009 21:16:23 +0000 Subject: [PATCH] Added a way to remove the application flags from the BAppFileInfo. The flags would not tell anything, since B_SINGLE_LAUNCH equals 0. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@29636 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- headers/os/storage/AppFileInfo.h | 1 + src/kits/storage/AppFileInfo.cpp | 27 +++++++++++++++++++++++---- 2 files changed, 24 insertions(+), 4 deletions(-) diff --git a/headers/os/storage/AppFileInfo.h b/headers/os/storage/AppFileInfo.h index 599926fd43..0473b9ec8e 100644 --- a/headers/os/storage/AppFileInfo.h +++ b/headers/os/storage/AppFileInfo.h @@ -67,6 +67,7 @@ class BAppFileInfo: public BNodeInfo { status_t GetAppFlags(uint32 *flags) const; status_t SetAppFlags(uint32 flags); + status_t RemoveAppFlags(); status_t GetSupportedTypes(BMessage *types) const; status_t SetSupportedTypes(const BMessage *types, bool syncAll); diff --git a/src/kits/storage/AppFileInfo.cpp b/src/kits/storage/AppFileInfo.cpp index 5977eb078f..09877acaec 100644 --- a/src/kits/storage/AppFileInfo.cpp +++ b/src/kits/storage/AppFileInfo.cpp @@ -379,10 +379,29 @@ BAppFileInfo::SetAppFlags(uint32 flags) error = B_NO_INIT; if (error == B_OK) { // write the data - if (error == B_OK) { - error = _WriteData(kAppFlagsAttribute, kAppFlagsResourceID, - B_APP_FLAGS_TYPE, &flags, sizeof(uint32)); - } + error = _WriteData(kAppFlagsAttribute, kAppFlagsResourceID, + B_APP_FLAGS_TYPE, &flags, sizeof(uint32)); + } + return error; +} + +// RemoveAppFlags +/*! \brief Removes the file's application flags. + \return + - \c B_OK: Everything went fine. + - \c B_NO_INIT: The object is not properly initialized. + - other error codes +*/ +status_t +BAppFileInfo::RemoveAppFlags() +{ + // check initialization + status_t error = B_OK; + if (error == B_OK && InitCheck() != B_OK) + error = B_NO_INIT; + if (error == B_OK) { + // remove the data + error = _RemoveData(kAppFlagsAttribute, B_APP_FLAGS_TYPE); } return error; }