headers/bsd: Add sys/queue.h.
[haiku.git] / src / kits / storage / mime / MimeEntryProcessor.cpp
blobc1034a0c3788d961033e459cb3129cb8f0e813a7
1 /*
2 * Copyright 2013, Haiku, Inc. All Rights Reserved.
3 * Distributed under the terms of the MIT License.
5 * Authors:
6 * Ingo Weinhold <ingo_weinhold@gmx.de>
7 */
10 #include <mime/AppMetaMimeCreator.h>
12 #include <Directory.h>
13 #include <Entry.h>
16 namespace BPrivate {
17 namespace Storage {
18 namespace Mime {
21 // #pragma mark - DatabaseLocker
24 MimeEntryProcessor::DatabaseLocker::~DatabaseLocker()
29 // #pragma mark - MimeEntryProcessor
32 MimeEntryProcessor::MimeEntryProcessor(Database* database,
33 DatabaseLocker* databaseLocker, int32 force)
35 fDatabase(database),
36 fDatabaseLocker(databaseLocker),
37 fForce(force)
42 MimeEntryProcessor::~MimeEntryProcessor()
47 status_t
48 MimeEntryProcessor::DoRecursively(const entry_ref& entry)
50 bool entryIsDir = false;
51 status_t error = Do(entry, &entryIsDir);
52 if (error != B_OK)
53 return error;
55 if (entryIsDir) {
56 BDirectory directory;
57 error = directory.SetTo(&entry);
58 if (error != B_OK)
59 return error;
61 entry_ref childEntry;
62 while (directory.GetNextRef(&childEntry) == B_OK)
63 DoRecursively(childEntry);
66 return B_OK;
70 } // namespace Mime
71 } // namespace Storage
72 } // namespace BPrivate