History log of /haiku/src/kits/storage/mime/database_support.cpp
Revision Date Author Comments
# 2ca13760 20-Aug-2021 Coldfirex <sakison@gmail.com>

Mass updating of OpenBeOS text to Haiku

No functional code altered.

https://dev.haiku-os.org/ticket/17197

Change-Id: I75cc74f6be0ad968fd77c31fbe5b0f650a6fe9e0
Reviewed-on: https://review.haiku-os.org/c/haiku/+/4364
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
Reviewed-by: Adrien Destugues <pulkomandy@gmail.com>


# 4b7e2196 03-Oct-2013 Ingo Weinhold <ingo_weinhold@gmx.de>

Remove /boot/common for good

* Remove support for the "common" installation location from packagefs,
package kit, package daemon, package managers.
* Rename the B_COMMON_*_DIRECTORY constants referring to writable
directories to B_SYSTEM_*_DIRECTORY.
* Remove/adjust the use of various B_COMMON_*_DIRECTORY constants.
I'm sure some occurrence still remain. They can be adjusted when the
remaining B_COMMON_*_DIRECTORY constants are removed.


# 418071ba 17-Aug-2013 Ingo Weinhold <ingo_weinhold@gmx.de>

MIME DB support: avoid static initialization order issue


# 57a7a6b9 07-May-2013 Ingo Weinhold <ingo_weinhold@gmx.de>

mime/database_support: Make buildable for host platform


# b94857b3 07-May-2013 Ingo Weinhold <ingo_weinhold@gmx.de>

Refactor MIME DB access

* Add class DatabaseLocation. It contains a list of the MIME DB
directory paths plus methods to access type files.
* Move all low-level MIME DB access functions from
database_{support,access} to DatabaseLocation. All code that formerly
used those now requires a DatabaseLocation object. In BMimeType and in
the registrar the default object is used, but the low-level classes
can now be reused with different locations.
* Move get_icon_data() from database_access to database_support and
delete the former, which is now empty.


# 59a653b5 06-May-2013 Ingo Weinhold <ingo_weinhold@gmx.de>

Support multiple MIME DB directories

Each installation location (system, common, common/non-packaged,
~/config, ~/config/non-package) can now have a read-only data/mime_db
directory. ~/config/settings/beos_mime is now named mime_db as well. The
contents of all directories makes up the MIME DB. Entries in more
specific locations shadow entries in more general locations. Only the
directory in ~/config/settings is where the registrar writes changes to.

The new layout allows packages to contribute entries to the MIME DB by
simply providing the respective files in data/mime_db. Consequently the
user settings directory is supposed to contain only the things the user
has actually changed.

Seems to work fine as far as tested. A few issues, though:
* The registrar doesn't monitor the directories yet, so it doesn't
notice entry changes due to package de-/activation.
* ATM it is not possible to remove a MIME type that is not in the user
settings directory, although the FileTypes GUI suggests that it is.
We'd have to work with white-outs, since we cannot remove the files in
the data/mime_db directories. Or, alternatively, the API has to be
extended and the FileTypes GUI adjusted to disable the "Remove" button
in such a case.


# 423d8dfe 18-Aug-2012 Alex Smith <alex@alex-smith.me.uk>

CID 714424: Operands don't affect result.

Storing size_t result of std::string::find_first_of in a uint32 then
checking against std::string::npos would never be true.


# bc0693b2 01-Dec-2009 Ingo Weinhold <ingo_weinhold@gmx.de>

* Construct the MIME data base directories lazily.
* Automatic whitespace cleanup.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@34399 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 4b9cf09f 29-Nov-2009 Ingo Weinhold <ingo_weinhold@gmx.de>

* Got rid of is_running_on_haiku(). It was used for the test environment,
but wouldn't work when running it on Haiku anyway. At any rate, it was
relatively expensive (uname()) and used already in the libbe
initialization.
* Got rid of the non-Haiku support of main_thread_for().


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@34371 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 18cd67c7 22-Jan-2009 Michael Lotz <mmlr@mlotz.ch>

Add missing headers (malloc/free, string functions, memcpy, etc. undeclared).


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@28982 a95241bf-73f2-0310-859d-f6bbb57e9c96


# bae87c91 06-Nov-2006 Axel Dörfler <axeld@pinc-software.de>

Added a new type for the vector icon format 'VICN' or B_VECTOR_ICON_TYPE.
It's hopefully now used everywhere instead of B_RAW_TYPE where appropriate.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@19219 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 9ecf9d1c 26-Aug-2006 Ingo Weinhold <ingo_weinhold@gmx.de>

Merge from layout management branch.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@18649 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 373d946f 30-May-2006 Axel Dörfler <axeld@pinc-software.de>

* create_app_meta_mime() now preserves the case when installing the
MIME type.
* We now write the META:TYPE attribute that contains the type with
preserved case (as in BeOS). We even currently check this whenever
a type is opened, but that can be removed later, again.
* BMimeType::GetSupportingApps() was broken for applications that
only support the super type.
* Also BMimeType::GetSupportingApps() preserves the case of the
signatures.
* Why on earth would we want to preserve the case of case insensitive
MIME types? Simple, this let's you query for those apps using case
sensitive queries, as Tracker uses for its "open with" functionality.
Strangely enough, that one still doesn't work, even though the query
predicate is now correct.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@17661 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 31dc79a1 03-Apr-2006 Axel Dörfler <axeld@pinc-software.de>

* Added B_MINI_ICON_TYPE and B_LARGE_ICON_TYPE to TypeConstants.h.
* Cleanup.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@16996 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 45c3a5cf 17-Jan-2005 Ingo Weinhold <ingo_weinhold@gmx.de>

Obtain user settings dir path via find_directory() now.


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@10814 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 60027f7e 16-Jan-2005 Ingo Weinhold <ingo_weinhold@gmx.de>

Use the standard MIME DB path when running under Haiku, but a different one when running under BeOS (so BeOS' MIME DB is not affected when running tests).


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@10784 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 417b2882 05-Aug-2003 Tyler Dauwalder <tylerdauwalder@nowhere.fake>

No reason for err to be an ssize_t in this function.


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@4233 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 17e6de7a 03-Aug-2003 shadow303 <shadow303@nowhere.fake>

gcc 3 fixes


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@4227 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 98977256 01-Oct-2002 Tyler Dauwalder <tylerdauwalder@nowhere.fake>

Added kMetaMimeType constant


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@1327 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 1bd963b6 23-Sep-2002 Tyler Dauwalder <tylerdauwalder@nowhere.fake>

+ Added file-extension based mime type guessing
+ Added sniffer rule based mime type guessing
+ Added get_device_icon()
+ Added complete (synchronous, asynchronous; recursive,
non-recursive; forcing, non-forcing; you name it we got it :-)
update_mime_info() implementation.


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@1152 a95241bf-73f2-0310-859d-f6bbb57e9c96


# b86972c2 28-Aug-2002 Tyler Dauwalder <tylerdauwalder@nowhere.fake>

Added GetSupportingApps() message field constants


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@924 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 32f45afc 27-Aug-2002 Tyler Dauwalder <tylerdauwalder@nowhere.fake>

+ Added GetInstalled[Super]Types functionality
+ Cleaned up warnings
+ Added documentation


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@899 a95241bf-73f2-0310-859d-f6bbb57e9c96


# e20a514a 23-Aug-2002 Tyler Dauwalder <tylerdauwalder@nowhere.fake>

After implementing the BMimeType::GetInstalled[Super]Types()
functionality, it became apparent that some restructuring was
needed if I wanted to keep things clean and managble.
storage/MimeDatabase.{h,cpp} have been broken into:

storage/mime/database_support.{h,cpp}
+ MIME database constants
+ high-level database access functions like open_type(),
read_mime_attr(), etc.

storage/mime/database_access.{h,cpp}
+ atomic read functions
+ is_installed()
+ get_icon_data()

storage/mime/Database.{h,cpp}
+ Mime::Database class, which is responsible for all write,
non-atomic read, and mime monitor functionality.

storage/mime/InstalledTypes.{h,cpp}
+ Helper class for Mime::Database::GetInstalled[Super]Types()

storage/mime/Supertype.{h,cpp}
+ Helper class for Mime::InstalledTypes

I haven't merged my intial, somewhat cludgy GetInstalled[Super]Types
implementation into the new setup yet. That comes next, and it ought
to be a more graceful implementation now.

I also implemented BMimeType::Get/SetSupportingTypes(), though
they haven't been tested yet (sorry).


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@862 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 4b7e219688450694efc9d1890f83f816758c16d3 03-Oct-2013 Ingo Weinhold <ingo_weinhold@gmx.de>

Remove /boot/common for good

* Remove support for the "common" installation location from packagefs,
package kit, package daemon, package managers.
* Rename the B_COMMON_*_DIRECTORY constants referring to writable
directories to B_SYSTEM_*_DIRECTORY.
* Remove/adjust the use of various B_COMMON_*_DIRECTORY constants.
I'm sure some occurrence still remain. They can be adjusted when the
remaining B_COMMON_*_DIRECTORY constants are removed.


# 418071ba652c9c3a2a2d664f9e228e0bcb8cb499 17-Aug-2013 Ingo Weinhold <ingo_weinhold@gmx.de>

MIME DB support: avoid static initialization order issue


# 57a7a6b9168931a2f209327bc40959a016ca8bb2 07-May-2013 Ingo Weinhold <ingo_weinhold@gmx.de>

mime/database_support: Make buildable for host platform


# b94857b322093c296230a18d47f6a98a2896b062 07-May-2013 Ingo Weinhold <ingo_weinhold@gmx.de>

Refactor MIME DB access

* Add class DatabaseLocation. It contains a list of the MIME DB
directory paths plus methods to access type files.
* Move all low-level MIME DB access functions from
database_{support,access} to DatabaseLocation. All code that formerly
used those now requires a DatabaseLocation object. In BMimeType and in
the registrar the default object is used, but the low-level classes
can now be reused with different locations.
* Move get_icon_data() from database_access to database_support and
delete the former, which is now empty.


# 59a653b51cdae6a8f87db8cb68c86998b48bfc62 06-May-2013 Ingo Weinhold <ingo_weinhold@gmx.de>

Support multiple MIME DB directories

Each installation location (system, common, common/non-packaged,
~/config, ~/config/non-package) can now have a read-only data/mime_db
directory. ~/config/settings/beos_mime is now named mime_db as well. The
contents of all directories makes up the MIME DB. Entries in more
specific locations shadow entries in more general locations. Only the
directory in ~/config/settings is where the registrar writes changes to.

The new layout allows packages to contribute entries to the MIME DB by
simply providing the respective files in data/mime_db. Consequently the
user settings directory is supposed to contain only the things the user
has actually changed.

Seems to work fine as far as tested. A few issues, though:
* The registrar doesn't monitor the directories yet, so it doesn't
notice entry changes due to package de-/activation.
* ATM it is not possible to remove a MIME type that is not in the user
settings directory, although the FileTypes GUI suggests that it is.
We'd have to work with white-outs, since we cannot remove the files in
the data/mime_db directories. Or, alternatively, the API has to be
extended and the FileTypes GUI adjusted to disable the "Remove" button
in such a case.


# 423d8dfed30eaaf5ae2563c1b9cbf7237805fe03 18-Aug-2012 Alex Smith <alex@alex-smith.me.uk>

CID 714424: Operands don't affect result.

Storing size_t result of std::string::find_first_of in a uint32 then
checking against std::string::npos would never be true.


# bc0693b219edee709fb76708eae78b1e18ada3f6 01-Dec-2009 Ingo Weinhold <ingo_weinhold@gmx.de>

* Construct the MIME data base directories lazily.
* Automatic whitespace cleanup.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@34399 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 4b9cf09f14ca4d93f9063d4b824758ce1ea599c0 29-Nov-2009 Ingo Weinhold <ingo_weinhold@gmx.de>

* Got rid of is_running_on_haiku(). It was used for the test environment,
but wouldn't work when running it on Haiku anyway. At any rate, it was
relatively expensive (uname()) and used already in the libbe
initialization.
* Got rid of the non-Haiku support of main_thread_for().


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@34371 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 18cd67c76072f825c4a7ba58414771d47fd1bfa2 22-Jan-2009 Michael Lotz <mmlr@mlotz.ch>

Add missing headers (malloc/free, string functions, memcpy, etc. undeclared).


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@28982 a95241bf-73f2-0310-859d-f6bbb57e9c96


# bae87c9140b843a16dd71b5ed9cf467f44b57b98 06-Nov-2006 Axel Dörfler <axeld@pinc-software.de>

Added a new type for the vector icon format 'VICN' or B_VECTOR_ICON_TYPE.
It's hopefully now used everywhere instead of B_RAW_TYPE where appropriate.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@19219 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 9ecf9d1c1d4888d341a6eac72112c72d1ae3a4cb 26-Aug-2006 Ingo Weinhold <ingo_weinhold@gmx.de>

Merge from layout management branch.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@18649 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 373d946f22d66c3466c8e52981c638a2e4e9cb8e 30-May-2006 Axel Dörfler <axeld@pinc-software.de>

* create_app_meta_mime() now preserves the case when installing the
MIME type.
* We now write the META:TYPE attribute that contains the type with
preserved case (as in BeOS). We even currently check this whenever
a type is opened, but that can be removed later, again.
* BMimeType::GetSupportingApps() was broken for applications that
only support the super type.
* Also BMimeType::GetSupportingApps() preserves the case of the
signatures.
* Why on earth would we want to preserve the case of case insensitive
MIME types? Simple, this let's you query for those apps using case
sensitive queries, as Tracker uses for its "open with" functionality.
Strangely enough, that one still doesn't work, even though the query
predicate is now correct.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@17661 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 31dc79a18b4e73cddd78b71b7d74e8edb680b6f0 03-Apr-2006 Axel Dörfler <axeld@pinc-software.de>

* Added B_MINI_ICON_TYPE and B_LARGE_ICON_TYPE to TypeConstants.h.
* Cleanup.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@16996 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 45c3a5cfa9a61e479761bff834e866910effd4f6 17-Jan-2005 Ingo Weinhold <ingo_weinhold@gmx.de>

Obtain user settings dir path via find_directory() now.


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@10814 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 60027f7eac442d7faea6b0106ede1c5c3e3af5f0 16-Jan-2005 Ingo Weinhold <ingo_weinhold@gmx.de>

Use the standard MIME DB path when running under Haiku, but a different one when running under BeOS (so BeOS' MIME DB is not affected when running tests).


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@10784 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 417b2882c92617b485f64555b8479097031e597c 05-Aug-2003 Tyler Dauwalder <tylerdauwalder@nowhere.fake>

No reason for err to be an ssize_t in this function.


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@4233 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 17e6de7a37c5c61f45eb724de108daa70905cb8f 03-Aug-2003 shadow303 <shadow303@nowhere.fake>

gcc 3 fixes


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@4227 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 989772566fb1c0498400965705e27fb47fc49432 01-Oct-2002 Tyler Dauwalder <tylerdauwalder@nowhere.fake>

Added kMetaMimeType constant


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@1327 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 1bd963b6c27017324c3589c8ea29d635e1552b7f 23-Sep-2002 Tyler Dauwalder <tylerdauwalder@nowhere.fake>

+ Added file-extension based mime type guessing
+ Added sniffer rule based mime type guessing
+ Added get_device_icon()
+ Added complete (synchronous, asynchronous; recursive,
non-recursive; forcing, non-forcing; you name it we got it :-)
update_mime_info() implementation.


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@1152 a95241bf-73f2-0310-859d-f6bbb57e9c96


# b86972c240500d717f9f033a8b165a2d7c92bb80 28-Aug-2002 Tyler Dauwalder <tylerdauwalder@nowhere.fake>

Added GetSupportingApps() message field constants


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@924 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 32f45afc2650a8b92c41a10a0fb552752d6b4036 27-Aug-2002 Tyler Dauwalder <tylerdauwalder@nowhere.fake>

+ Added GetInstalled[Super]Types functionality
+ Cleaned up warnings
+ Added documentation


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@899 a95241bf-73f2-0310-859d-f6bbb57e9c96


# e20a514ae90bd65d06ff19517a1220b3f92760ee 23-Aug-2002 Tyler Dauwalder <tylerdauwalder@nowhere.fake>

After implementing the BMimeType::GetInstalled[Super]Types()
functionality, it became apparent that some restructuring was
needed if I wanted to keep things clean and managble.
storage/MimeDatabase.{h,cpp} have been broken into:

storage/mime/database_support.{h,cpp}
+ MIME database constants
+ high-level database access functions like open_type(),
read_mime_attr(), etc.

storage/mime/database_access.{h,cpp}
+ atomic read functions
+ is_installed()
+ get_icon_data()

storage/mime/Database.{h,cpp}
+ Mime::Database class, which is responsible for all write,
non-atomic read, and mime monitor functionality.

storage/mime/InstalledTypes.{h,cpp}
+ Helper class for Mime::Database::GetInstalled[Super]Types()

storage/mime/Supertype.{h,cpp}
+ Helper class for Mime::InstalledTypes

I haven't merged my intial, somewhat cludgy GetInstalled[Super]Types
implementation into the new setup yet. That comes next, and it ought
to be a more graceful implementation now.

I also implemented BMimeType::Get/SetSupportingTypes(), though
they haven't been tested yet (sorry).


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@862 a95241bf-73f2-0310-859d-f6bbb57e9c96