1 /* 2 * Copyright 2013, Haiku, Inc. All Rights Reserved. 3 * Distributed under the terms of the MIT License. 4 * 5 * Authors: 6 * Ingo Weinhold <ingo_weinhold@gmx.de> 7 */ 8 9 10 #include <mime/AppMetaMimeCreator.h> 11 12 #include <Directory.h> 13 #include <Entry.h> 14 15 16 namespace BPrivate { 17 namespace Storage { 18 namespace Mime { 19 20 21 // #pragma mark - DatabaseLocker 22 23 24 MimeEntryProcessor::DatabaseLocker::~DatabaseLocker() 25 { 26 } 27 28 29 // #pragma mark - MimeEntryProcessor 30 31 32 MimeEntryProcessor::MimeEntryProcessor(Database* database, 33 DatabaseLocker* databaseLocker, int32 force) 34 : 35 fDatabase(database), 36 fDatabaseLocker(databaseLocker), 37 fForce(force) 38 { 39 } 40 41 42 MimeEntryProcessor::~MimeEntryProcessor() 43 { 44 } 45 46 47 status_t 48 MimeEntryProcessor::DoRecursively(const entry_ref& entry) 49 { 50 bool entryIsDir = false; 51 status_t error = Do(entry, &entryIsDir); 52 if (error != B_OK) 53 return error; 54 55 if (entryIsDir) { 56 BDirectory directory; 57 error = directory.SetTo(&entry); 58 if (error != B_OK) 59 return error; 60 61 entry_ref childEntry; 62 while (directory.GetNextRef(&childEntry) == B_OK) 63 DoRecursively(childEntry); 64 } 65 66 return B_OK; 67 } 68 69 70 } // namespace Mime 71 } // namespace Storage 72 } // namespace BPrivate 73