1 /* 2 * Copyright 2002-2008, Haiku Inc. 3 * Distributed under the terms of the MIT License. 4 * 5 * Authors: 6 * Tyler Dauwalder 7 * Ingo Weinhold, bonefish@users.sf.net 8 */ 9 10 /*! 11 \file Mime.cpp 12 Mime type C functions implementation. 13 */ 14 15 #include <mime/database_access.h> 16 #include <mime/UpdateMimeInfoThread.h> 17 18 using namespace BPrivate; 19 20 // update_mime_info 21 /*! \brief Updates the MIME information (i.e MIME type) for one or more files. 22 If \a path points to a file, the MIME information for this file are 23 updated only. If it points to a directory and \a recursive is non-null, 24 the information for all the files in the given directory tree are updated. 25 If path is \c NULL all files are considered; \a recursive is ignored in 26 this case. 27 \param path The path to a file or directory, or \c NULL. 28 \param recursive Non-null to trigger recursive behavior. 29 \param synchronous If non-null update_mime_info() waits until the 30 operation is finished, otherwise it returns immediately and the 31 update is done asynchronously. 32 \param force If non-null, also the information for files are updated that 33 have already been updated. 34 \return 35 - \c B_OK: Everything went fine. 36 - An error code otherwise. 37 */ 38 int 39 update_mime_info(const char *path, int recursive, int synchronous, int force) 40 { 41 if (!path) 42 return B_BAD_VALUE; 43 44 entry_ref ref; 45 status_t error = get_ref_for_path(path, &ref); 46 if (error != B_OK) 47 return error; 48 49 BPrivate::Storage::Mime::UpdateMimeInfoThread updater("MIME update thread", 50 B_NORMAL_PRIORITY, BMessenger(), &ref, recursive, force, NULL); 51 return updater.DoUpdate(); 52 } 53 54 // create_app_meta_mime 55 /*! Creates a MIME database entry for one or more applications. 56 \a path should either point to an application file or should be \c NULL. 57 In the first case a MIME database entry for that application is created, 58 in the second case entries for all applications are created. 59 \param path The path to an application file, or \c NULL. 60 \param recursive Currently unused. 61 \param synchronous If non-null create_app_meta_mime() waits until the 62 operation is finished, otherwise it returns immediately and the 63 operation is done asynchronously. 64 \param force If non-null, entries are created even if they do already 65 exist. 66 \return 67 - \c B_OK: Everything went fine. 68 - An error code otherwise. 69 */ 70 status_t 71 create_app_meta_mime(const char *path, int recursive, int synchronous, 72 int force) 73 { 74 // We don't have a MIME DB... 75 return B_OK; 76 } 77