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; }