[haiku-commits] BRANCH HaikuPM-github.package-management [59a653b] in src/data: mime_db/application beos_mime/application mime_db beos_mime mime_db/text

  • From: HaikuPM-github.package-management <community@xxxxxxxxxxxx>
  • To: haiku-commits@xxxxxxxxxxxxx
  • Date: Tue, 7 May 2013 04:45:29 +0200 (CEST)

added 7 changesets to branch 'refs/remotes/HaikuPM-github/package-management'
old head: 9abd3e6f53602c5fc3ad5676992bc27d40640e1b
new head: 59a653b51cdae6a8f87db8cb68c86998b48bfc62
overview: https://github.com/haiku/HaikuPM/compare/9abd3e6...59a653b

----------------------------------------------------------------------------

853b8a4: CreateAppMetaMimeThread: Use open_type()
  
  ... instead of constructing the MIME type file path manually.

eef74ff: Remove packages Zlib[-devel] from ReleaseBuildProfiles
  
  Instead add Zlib as a mandatory package and Zlib-devel as a Development
  dependency.

fa5dff5: Replace various boolean rule parameters by flags
  
  Instead of the boolean alwaysUpdate, isCDPackage, and stripDebugSymbols
  parameters use a uniform flags parameter which can contain any of the
  respectively supported flags (alwaysUpdate, cdPackage,
  stripDebugSymbols, !stripDebugSymbols).

d6a6e2c: rule CopyDirectoryToContainer: Add flags isTarget
  
  The flags indicates that the passed sourceDirectory is a target, not a
  path.

e387e24: Move MIME DB creation from build_haiku_image to jam build system
  
  * build_haiku_image: Remove MIME DB creation code.
  * Rename beos_mime source directory to mime_db.
  * Add rules to build the MIME DB in the source directory's jamfile.
  * Add MIME DB directory to haiku.hpkg in data/mime_db.

38e3973: Add private class BMergedDirectory to storage kit
  
  An arbitrary number of directories can be added, which the implemented
  BEntryList interface presents as a single merged entry list. Three
  different merge policies are supported which define how entries that
  appear in more than one directory are treated.

59a653b: 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.

                                    [ Ingo Weinhold <ingo_weinhold@xxxxxx> ]

----------------------------------------------------------------------------

138 files changed, 930 insertions(+), 315 deletions(-)
build/jam/ImageRules                             |  97 ++++---
build/jam/OptionalLibPackages                    |  34 +--
build/jam/OptionalPackageDependencies            |   7 +-
build/jam/OptionalPackages                       | 130 ++++-----
build/jam/PackageRules                           |  13 +-
build/jam/ReleaseBuildProfiles                   |   2 -
build/jam/UserBuildConfig.ReadMe                 |   2 +-
build/jam/packages/Haiku                         |   4 +
build/scripts/build_haiku_image                  |  53 ----
headers/private/storage/MergedDirectory.h        |  72 +++++
headers/private/storage/mime/database_support.h  |  10 +-
src/data/Jamfile                                 |   1 +
src/data/mime_db/Jamfile                         | 107 +++++++
.../{beos_mime => mime_db}/application.super     |   0
.../{beos_mime => mime_db}/application/msword    |   0
src/data/{beos_mime => mime_db}/application/ogg  |   0
src/data/{beos_mime => mime_db}/application/pdf  |   0
.../application/postscript                       |   0
.../application/vnd.ms-excel                     |   0
.../application/vnd.ms-powerpoint                |   0
.../application/vnd.ms-works                     |   0
.../application/x-7z-compressed                  |   0
.../application/x-bfs-image                      |   0
.../application/x-bittorrent                     |   0
.../{beos_mime => mime_db}/application/x-bzip2   |   0
.../application/x-cd-image                       |   0
.../application/x-font-ttf                       |   0
.../{beos_mime => mime_db}/application/x-gzip    |   0
.../{beos_mime => mime_db}/application/x-lharc   |   0
.../application/x-msaccess                       |   0
.../{beos_mime => mime_db}/application/x-person  |   0
.../{beos_mime => mime_db}/application/x-rar     |   0
.../application/x-scode-upkg                     |   0
.../{beos_mime => mime_db}/application/x-tar     |   0
.../application/x-vnd.be-bookmark                |   0
.../application/x-vnd.be-directory               |   0
.../application/x-vnd.be-elfexecutable           |   0
.../application/x-vnd.be-query                   |   0
.../application/x-vnd.be-querytemplate           |   0
.../application/x-vnd.be-symlink                 |   0
.../application/x-vnd.be-volume                  |   0
.../application/x-vnd.be.url.beshare             |   0
.../application/x-vnd.be.url.file                |   0
.../application/x-vnd.be.url.finger              |   0
.../application/x-vnd.be.url.ftp                 |   0
.../application/x-vnd.be.url.gopher              |   0
.../application/x-vnd.be.url.http                |   0
.../application/x-vnd.be.url.https               |   0
.../application/x-vnd.be.url.mailto              |   0
.../application/x-vnd.be.url.mms                 |   0
.../application/x-vnd.be.url.news                |   0
.../application/x-vnd.be.url.nfs                 |   0
.../application/x-vnd.be.url.query               |   0
.../application/x-vnd.be.url.rsync               |   0
.../application/x-vnd.be.url.rtp                 |   0
.../application/x-vnd.be.url.rtsp                |   0
.../application/x-vnd.be.url.sftp                |   0
.../application/x-vnd.be.url.ssh                 |   0
.../application/x-vnd.be.url.telnet              |   0
.../application/x-vnd.haiku-icon                 |   0
.../{beos_mime => mime_db}/application/x-xar     |   0
src/data/{beos_mime => mime_db}/application/x-xz |   0
src/data/{beos_mime => mime_db}/application/zip  |   0
src/data/{beos_mime => mime_db}/audio.super      |   0
src/data/{beos_mime => mime_db}/audio/ac3        |   0
src/data/{beos_mime => mime_db}/audio/basic      |   0
src/data/{beos_mime => mime_db}/audio/mid        |   0
src/data/{beos_mime => mime_db}/audio/midi       |   0
src/data/{beos_mime => mime_db}/audio/mp4        |   0
src/data/{beos_mime => mime_db}/audio/mpeg       |   0
src/data/{beos_mime => mime_db}/audio/ogg        |   0
src/data/{beos_mime => mime_db}/audio/x-aiff     |   0
src/data/{beos_mime => mime_db}/audio/x-ape      |   0
src/data/{beos_mime => mime_db}/audio/x-flac     |   0
src/data/{beos_mime => mime_db}/audio/x-matroska |   0
src/data/{beos_mime => mime_db}/audio/x-mdx      |   0
src/data/{beos_mime => mime_db}/audio/x-musepack |   0
src/data/{beos_mime => mime_db}/audio/x-wav      |   0
src/data/{beos_mime => mime_db}/image.super      |   0
src/data/{beos_mime => mime_db}/image/bmp        |   0
src/data/{beos_mime => mime_db}/image/gif        |   0
src/data/{beos_mime => mime_db}/image/icns       |   0
src/data/{beos_mime => mime_db}/image/jp2        |   0
src/data/{beos_mime => mime_db}/image/jpeg       |   0
src/data/{beos_mime => mime_db}/image/png        |   0
src/data/{beos_mime => mime_db}/image/sgi        |   0
src/data/{beos_mime => mime_db}/image/svg+xml    |   0
src/data/{beos_mime => mime_db}/image/tiff       |   0
.../image/vnd.microsoft.icon                     |   0
src/data/{beos_mime => mime_db}/image/webp       |   0
src/data/{beos_mime => mime_db}/image/x-pcx      |   0
.../image/x-portable-pixmap                      |   0
src/data/{beos_mime => mime_db}/image/x-targa    |   0
src/data/{beos_mime => mime_db}/image/x-wpg      |   0
src/data/{beos_mime => mime_db}/message.super    |   0
src/data/{beos_mime => mime_db}/message/rfc822   |   0
src/data/{beos_mime => mime_db}/multipart.super  |   0
src/data/{beos_mime => mime_db}/text.super       |   0
src/data/{beos_mime => mime_db}/text/calendar    |   0
[ *** stats truncated: 39 lines dropped *** ]

############################################################################

Commit:      853b8a4de57bf2c55455bbcb45f759319da1e5be
Author:      Ingo Weinhold <ingo_weinhold@xxxxxx>
Date:        Mon May  6 05:20:11 2013 UTC

CreateAppMetaMimeThread: Use open_type()

... instead of constructing the MIME type file path manually.

----------------------------------------------------------------------------

diff --git a/src/servers/registrar/mime/CreateAppMetaMimeThread.cpp 
b/src/servers/registrar/mime/CreateAppMetaMimeThread.cpp
index 8dcd1b7..3c38281 100644
--- a/src/servers/registrar/mime/CreateAppMetaMimeThread.cpp
+++ b/src/servers/registrar/mime/CreateAppMetaMimeThread.cpp
@@ -46,8 +46,6 @@ CreateAppMetaMimeThread::DoMimeUpdate(const entry_ref* ref, 
bool* _entryIsDir)
        if (ref == NULL)
                return B_BAD_VALUE;
 
-       BNode typeNode;
-
        BFile file;
        status_t status = file.SetTo(ref, B_READ_ONLY | O_NOTRAVERSE);
        if (status < B_OK)
@@ -85,14 +83,8 @@ CreateAppMetaMimeThread::DoMimeUpdate(const entry_ref* ref, 
bool* _entryIsDir)
        if (!mime.IsInstalled())
                mime.Install();
 
-       BString path = "/";
-       path.Append(signature);
-       path.ToLower();
-               // Signatures and MIME types are case insensitive, but we want 
to
-               // preserve the case wherever possible
-       path.Prepend(get_database_directory().c_str());
-
-       status = typeNode.SetTo(path.String());
+       BNode typeNode;
+       status = open_type(signature, &typeNode);
        if (status < B_OK)
                return status;
 

############################################################################

Commit:      eef74ff29879ac29d794c1f6052f75695377e362
Author:      Ingo Weinhold <ingo_weinhold@xxxxxx>
Date:        Mon May  6 17:55:06 2013 UTC

Remove packages Zlib[-devel] from ReleaseBuildProfiles

Instead add Zlib as a mandatory package and Zlib-devel as a Development
dependency.

----------------------------------------------------------------------------

diff --git a/build/jam/OptionalPackageDependencies 
b/build/jam/OptionalPackageDependencies
index 0b8aadd..e050ed0 100644
--- a/build/jam/OptionalPackageDependencies
+++ b/build/jam/OptionalPackageDependencies
@@ -1,8 +1,5 @@
 
 # package dependencies
-#
-# For transitive dependencies dependents should be listed before their
-# dependencies.
 
 OptionalPackageDependencies APR-util : APR Expat ;
 OptionalPackageDependencies AllegroLibs : XiphLibs ;
@@ -14,7 +11,7 @@ OptionalPackageDependencies Caya : Expat ;
 OptionalPackageDependencies CDRecord : GetText LibIconv ;
 OptionalPackageDependencies Curl : OpenSSL ;
 OptionalPackageDependencies DevelopmentBase : CDRecord DevelopmentMin Yasm ;
-OptionalPackageDependencies Development : DevelopmentBase Perl ;
+OptionalPackageDependencies Development : DevelopmentBase Perl Zlib-devel ;
 OptionalPackageDependencies DevelopmentPowerPC : DevelopmentMin ;
 OptionalPackageDependencies GetText : LibIconv ;
 OptionalPackageDependencies Git : Expat Curl OpenSSL LibIconv ;
@@ -47,4 +44,4 @@ OptionalPackageDependencies XZ-Utils : Tar ;
 OptionalPackageDependencies Zlib-devel : Zlib ;
 
 OptionalPackageDependencies MandatoryPackages
-       : Bzip Ctags Grep ICU LibSolv Sed Tar ;
+       : Bzip Ctags Grep ICU LibSolv Sed Tar Zlib ;
diff --git a/build/jam/ReleaseBuildProfiles b/build/jam/ReleaseBuildProfiles
index 923c9dd..295056a 100644
--- a/build/jam/ReleaseBuildProfiles
+++ b/build/jam/ReleaseBuildProfiles
@@ -27,7 +27,6 @@ switch $(HAIKU_BUILD_PROFILE) {
                AddOptionalHaikuImagePackages KeymapSwitcher Nano P7zip Welcome
                        BeBook XZ-Utils ;
                AddOptionalHaikuImagePackages wpa_supplicant Man ;
-               AddOptionalHaikuImagePackages Zlib Zlib-devel ;
        }
 
        case "beta-*" : {
@@ -46,7 +45,6 @@ switch $(HAIKU_BUILD_PROFILE) {
                AddOptionalHaikuImagePackages Pe Nano Vision P7zip XZ-Utils ;
                AddOptionalHaikuImagePackages Development Git OpenSSH OpenSSL ;
                AddOptionalHaikuImagePackages wpa_supplicant WebPositive Man ;
-               AddOptionalHaikuImagePackages Zlib Zlib-devel ;
        }
 }
 

############################################################################

Commit:      fa5dff5529d819291e62ac867fca3d27a527cbad
Author:      Ingo Weinhold <ingo_weinhold@xxxxxx>
Date:        Tue May  7 00:38:55 2013 UTC

Replace various boolean rule parameters by flags

Instead of the boolean alwaysUpdate, isCDPackage, and stripDebugSymbols
parameters use a uniform flags parameter which can contain any of the
respectively supported flags (alwaysUpdate, cdPackage,
stripDebugSymbols, !stripDebugSymbols).

----------------------------------------------------------------------------

diff --git a/build/jam/ImageRules b/build/jam/ImageRules
index cc48814..20036e1 100644
--- a/build/jam/ImageRules
+++ b/build/jam/ImageRules
@@ -312,17 +312,18 @@ rule FSymlinksInContainerDirectory container : 
directoryTokens
 }
 
 rule CopyDirectoryToContainer container : directoryTokens : sourceDirectory
-       : targetDirectoryName : excludePatterns : alwaysUpdate
+       : targetDirectoryName : excludePatterns : flags
 {
        # CopyDirectoryToContainer <container> : <directoryTokens>
        #       : <sourceDirectory> : <targetDirectoryName> : <excludePatterns>
-       #       : <alwaysUpdate> ;
+       #       [ : <flags> ] ;
        #
+       # Supported flags: alwaysUpdate
 
        # If the image shall only be updated, we don't copy any directories
        if [ on $(container) return $(HAIKU_CONTAINER_UPDATE_ONLY) ]
                        && ! [ IncludeAllTargetsInContainer $(container) ]
-                       && ! $(alwaysUpdate) {
+                       && ! alwaysUpdate in $(flags) {
                return ;
        }
 
@@ -343,17 +344,19 @@ rule CopyDirectoryToContainer container : directoryTokens 
: sourceDirectory
 
 
 rule AddHeaderDirectoryToContainer container : dirTokens : dirName
-       : alwaysUpdate
+       : flags
 {
        # AddHeaderDirectoryToContainer <container> : <dirTokens> : [ <dirName> 
]
-       #       : <alwaysUpdate> ;
+       #       [ : <flags> ] ;
+       #
+       # Supported flags: alwaysUpdate
 
        local systemDirTokens
                = [ on $(container) return $(HAIKU_CONTAINER_SYSTEM_DIR_TOKENS) 
] ;
 
        CopyDirectoryToContainer $(container) : $(systemDirTokens) develop 
headers
                : [ FDirName $(HAIKU_TOP) headers $(dirTokens) ]
-               : $(dirName) : -x .svn : $(alwaysUpdate) ;
+               : $(dirName) : -x .svn : $(flags) ;
 }
 
 
@@ -380,20 +383,26 @@ rule AddWifiFirmwareToContainer container : driver : 
package : archive : extract
 
 
 rule ExtractArchiveToContainer container : directoryTokens : archiveFile
-       : alwaysUpdate : extractedSubDir : stripDebugSymbols
+       : flags : extractedSubDir
 {
        # ExtractArchiveToContainer <container> : <directory> : <archiveFile>
-       #       : <alwaysUpdate> : <extractedSubDir> : <stripDebugSymbols> ;
+       #       : [ <flags> ] : <extractedSubDir> ;
+       #
+       # Supported flags: alwaysUpdate, stripDebugSymbols
 
        # If the container shall only be updated, we extract only, if 
explicitely
        # requested.
        if [ on $(container) return $(HAIKU_CONTAINER_UPDATE_ONLY) ]
-               && ! $(alwaysUpdate) {
+               && ! alwaysUpdate in $(flags) {
                return ;
        }
 
        local directory = [ AddDirectoryToContainer $(container)
                : $(directoryTokens) ] ;
+       local stripDebugSymbols ;
+       if stripDebugSymbols in $(flags) {
+               stripDebugSymbols = 1 ;
+       }
 
        ARCHIVE_FILES_TO_INSTALL on $(directory) += $(archiveFile) ;
        ARCHIVE_SUBDIR_TO_INSTALL_FROM on $(archiveFile) = $(extractedSubDir) ;
@@ -828,29 +837,29 @@ rule FSymlinksInHaikuImageDirectory directoryTokens
 }
 
 rule CopyDirectoryToHaikuImage directoryTokens : sourceDirectory
-       : targetDirectoryName : excludePatterns : alwaysUpdate
+       : targetDirectoryName : excludePatterns : flags
 {
        CopyDirectoryToContainer $(HAIKU_IMAGE_CONTAINER_NAME) : 
$(directoryTokens)
                : $(sourceDirectory) : $(targetDirectoryName) : 
$(excludePatterns)
-               : $(alwaysUpdate) ;
+               : $(flags) ;
 }
 
-rule AddSourceDirectoryToHaikuImage dirTokens : alwaysUpdate
+rule AddSourceDirectoryToHaikuImage dirTokens : flags
 {
-       # AddSourceDirectoryToHaikuImage <dirTokens> : <alwaysUpdate> ;
+       # AddSourceDirectoryToHaikuImage <dirTokens> : <flags> ;
 
        CopyDirectoryToHaikuImage home HaikuSources
                : [ FDirName $(HAIKU_TOP) $(dirTokens) ]
-               : : : $(alwaysUpdate) ;
+               : : : $(flags) ;
 }
 
-rule AddHeaderDirectoryToHaikuImage dirTokens : dirName : alwaysUpdate
+rule AddHeaderDirectoryToHaikuImage dirTokens : dirName : flags
 {
        # AddHeaderDirectoryToHaikuImage <dirTokens> : [ <dirName> ]
-       #       : <alwaysUpdate> ;
+       #       : <flags> ;
 
        AddHeaderDirectoryToContainer $(HAIKU_IMAGE_CONTAINER_NAME) : 
$(dirTokens)
-               : $(dirName) : $(alwaysUpdate) ;
+               : $(dirName) : $(flags) ;
 }
 
 rule AddWifiFirmwareToHaikuImage driver : package : archive : extract
@@ -861,15 +870,14 @@ rule AddWifiFirmwareToHaikuImage driver : package : 
archive : extract
                : $(package) : $(archive) : $(extract) ;
 }
 
-rule ExtractArchiveToHaikuImage dirTokens : archiveFile : alwaysUpdate
-       : extractedSubDir : stripDebugSymbols
+rule ExtractArchiveToHaikuImage dirTokens : archiveFile : flags
+       : extractedSubDir
 {
-       # ExtractArchiveToHaikuImage <dirTokens> : <archiveFile> : 
<alwaysUpdate>
+       # ExtractArchiveToHaikuImage <dirTokens> : <archiveFile> : <flags>
        #       : <extractedSubDir> ;
 
        ExtractArchiveToContainer $(HAIKU_IMAGE_CONTAINER_NAME) : $(dirTokens)
-               : $(archiveFile) : $(alwaysUpdate) : $(extractedSubDir)
-               : $(stripDebugSymbols) ;
+               : $(archiveFile) : $(flags) : $(extractedSubDir) ;
 }
 
 rule AddDriversToHaikuImage relativeDirectoryTokens : targets
@@ -962,20 +970,21 @@ rule InstallSourceArchive file : url
        }
 }
 
-rule InstallOptionalHaikuImagePackage url : dirTokens : isCDPackage
-       : stripDebugSymbols
+rule InstallOptionalHaikuImagePackage url : dirTokens : flags
 {
        # TODO: Remove the non-hpkg cases!
-       # Currently the semantics differs depending on isCDPackage and the type 
of
-       # the package file:
+       # Currently the semantics differs depending on whether the  cdPackage 
flag
+       # has been specified and the type of the package file:
        # * For a hpkg <dirTokens> is "common" (default) or "system" and 
specifies
        #   the installation location of the package (will be copied to the
        #   packages/ subdirectory).
-       # * For a regular archive and isCDPackage true, <dirTokens> is ignored 
and
+       # * For a regular archive and cdPackage, <dirTokens> is ignored and
        #   the package will be copied to the _package_ directory of the CD 
image.
-       # * For a regular archive and isCDPackage false, <dirTokens> specifies 
the
+       # * For a regular archive and without cdPackage, <dirTokens> specifies 
the
        #   directory relative to the image's root directory where the content 
of
        #   the archive will be extracted to.
+       #
+       # Supported flags: cdPackage, stripDebugSymbols/!stripDebugSymbols
 
        local package = $(url:BS) ;
 
@@ -988,24 +997,19 @@ rule InstallOptionalHaikuImagePackage url : dirTokens : 
isCDPackage
                        HAIKU_INCLUDE_IN_IMAGE on $(archiveFile) = 1 ;
                }
                AddPackageFilesToHaikuImage $(location) : $(archiveFile) ;
-       } else if ( $(isCDPackage) = true || $(isCDPackage) = 1 )
-               && $(HAIKU_CD_NAME) {
+       } else if cdPackage in $(flags) && $(HAIKU_CD_NAME) {
                # TODO: If HAIKU_CD_NAME is set, that doesn't mean we're 
building a CD
                # image!
                # copy onto image
                AddFilesToHaikuImage _packages_ : $(archiveFile) ;
        } else {
-               if $(HAIKU_STRIP_DEBUG_FROM_OPTIONAL_PACKAGES) = 1 {
-                       stripDebugSymbols ?= 1 ;
-                       # The script will only test for = 1. This is in case 
someone
-                       # manually set the flag 'true'
-                       if $(stripDebugSymbols) = true {
-                               stripDebugSymbols = 1 ;
-                       }
+               if $(HAIKU_STRIP_DEBUG_FROM_OPTIONAL_PACKAGES) = 1
+                       && ! stripDebugSymbols in $(flags)
+                       && ! !stripDebugSymbols in $(flags) {
+                       flags += stripDebugSymbols ;
                }
                # extract onto image
-               ExtractArchiveToHaikuImage $(dirTokens) : $(archiveFile)
-                       : : : $(stripDebugSymbols) ;
+               ExtractArchiveToHaikuImage $(dirTokens) : $(archiveFile) : 
$(flags) ;
        }
 }
 
diff --git a/build/jam/OptionalLibPackages b/build/jam/OptionalLibPackages
index 8e1aa6d..7344a2b 100644
--- a/build/jam/OptionalLibPackages
+++ b/build/jam/OptionalLibPackages
@@ -53,7 +53,7 @@ if [ IsOptionalHaikuImagePackageAdded box2d ] {
                if $(HAIKU_GCC_VERSION[1]) >= 4 {
                        InstallOptionalHaikuImagePackage
                                
$(baseURL)/lib/box2d-2.1.2-r1a4-x86-gcc4-2012-09-09.zip
-                               : : true ;
+                               : : cdPackage ;
                } else {
                        Echo "No optional package box2d available for 
$(TARGET_ARCH)-gcc2" ;
                }
@@ -68,11 +68,11 @@ if [ IsOptionalHaikuImagePackageAdded fribidi ] {
        } else if $(HAIKU_GCC_VERSION[1]) >= 4 {
                InstallOptionalHaikuImagePackage
                        
$(baseURL)/lib/fribidi-0.19.2-r1a4-x86-gcc4-2012-09-01.zip
-                       : : true ;
+                       : : cdPackage ;
        } else {
                InstallOptionalHaikuImagePackage
                        
$(baseURL)/lib/fribidi-0.19.2-r1a4-x86-gcc2-2012-08-29.zip
-                       : : true ;
+                       : : cdPackage ;
        }
 }
 
@@ -84,11 +84,11 @@ if [ IsOptionalHaikuImagePackageAdded lcms ] {
        } else if $(HAIKU_GCC_VERSION[1]) >= 4 {
                InstallOptionalHaikuImagePackage
                        $(baseURL)/lib/lcms-2.1-r1a4-x86-gcc4-2012-09-02.zip
-                       : : true ;
+                       : : cdPackage ;
        } else {
                InstallOptionalHaikuImagePackage
                        $(baseURL)/lib/lcms-2.1-r1a4-x86-gcc2-2012-08-29.zip
-                       : : true ;
+                       : : cdPackage ;
        }
 }
 
@@ -100,11 +100,11 @@ if [ IsOptionalHaikuImagePackageAdded libart_lgpl ] {
        } else if $(HAIKU_GCC_VERSION[1]) >= 4 {
                InstallOptionalHaikuImagePackage
                        
$(baseURL)/lib/libart_lgpl-2.3.21-r1a4-x86-gcc4-2012-09-02.zip
-                       : : true ;
+                       : : cdPackage ;
        } else {
                InstallOptionalHaikuImagePackage
                        
$(baseURL)/lib/libart_lgpl-2.3.21-r1a4-x86-gcc2-2012-08-29.zip
-                       : : true ;
+                       : : cdPackage ;
        }
 }
 
@@ -116,11 +116,11 @@ if [ IsOptionalHaikuImagePackageAdded libmad ] {
        } else if $(HAIKU_GCC_VERSION[1]) >= 4 {
                InstallOptionalHaikuImagePackage
                        
$(baseURL)/lib/libmad-0.15.1b-r1a4-x86-gcc4-2012-09-02.zip
-                       : : true ;
+                       : : cdPackage ;
        } else {
                InstallOptionalHaikuImagePackage
                        
$(baseURL)/lib/libmad-0.15.1b-r1a4-x86-gcc2-2012-08-29.zip
-                       : : true ;
+                       : : cdPackage ;
        }
 }
 
@@ -132,11 +132,11 @@ if [ IsOptionalHaikuImagePackageAdded libmikmod ] {
        } else if $(HAIKU_GCC_VERSION[1]) >= 4 {
                InstallOptionalHaikuImagePackage
                        
$(baseURL)/lib/libmikmod-3.1.11-r1a4-x86-gcc4-2012-09-02.zip
-                       : : true ;
+                       : : cdPackage ;
        } else {
                InstallOptionalHaikuImagePackage
                        
$(baseURL)/lib/libmikmod-3.1.11-r1a4-x86-gcc2-2012-08-29.zip
-                       : : true ;
+                       : : cdPackage ;
        }
 }
 
@@ -148,11 +148,11 @@ if [ IsOptionalHaikuImagePackageAdded libmodplug ] {
        } else if $(HAIKU_GCC_VERSION[1]) >= 4 {
                InstallOptionalHaikuImagePackage
                        
$(baseURL)/lib/libmodplug-0.8.8.4-r1a4-x86-gcc4-2012-09-02.zip
-                       : : true ;
+                       : : cdPackage ;
        } else {
                InstallOptionalHaikuImagePackage
                        
$(baseURL)/lib/libmodplug-0.8.8.4-r1a4-x86-gcc2-2012-08-29.zip
-                       : : true ;
+                       : : cdPackage ;
        }
 }
 
@@ -164,11 +164,11 @@ if [ IsOptionalHaikuImagePackageAdded libpaper ] {
        } else if $(HAIKU_GCC_VERSION[1]) >= 4 {
                InstallOptionalHaikuImagePackage
                        
$(baseURL)/lib/libpaper-1.1.24-r1a4-x86-gcc4-2012-09-01.zip
-                       : : true ;
+                       : : cdPackage ;
        } else {
                InstallOptionalHaikuImagePackage
                        
$(baseURL)/lib/libpaper-1.1.24-r1a4-x86-gcc4-2012-09-01.zip
-                       : : true ;
+                       : : cdPackage ;
        }
 }
 
@@ -180,11 +180,11 @@ if [ IsOptionalHaikuImagePackageAdded physfs ] {
        } else if $(HAIKU_GCC_VERSION[1]) >= 4 {
                InstallOptionalHaikuImagePackage
                        $(baseURL)/lib/physfs-2.0.1-r1a4-x86-gcc4-2012-09-09.zip
-                       : : true ;
+                       : : cdPackage ;
        } else {
                InstallOptionalHaikuImagePackage
                        $(baseURL)/lib/physfs-2.0.1-r1a4-x86-gcc2-2012-08-29.zip
-                       : : true ;
+                       : : cdPackage ;
        }
 }
 
diff --git a/build/jam/OptionalPackages b/build/jam/OptionalPackages
index a261f10..6059e7f 100644
--- a/build/jam/OptionalPackages
+++ b/build/jam/OptionalPackages
@@ -132,7 +132,7 @@ if [ IsOptionalHaikuImagePackageAdded APR ] {
                if $(HAIKU_GCC_VERSION[1]) >= 4 {
                        InstallOptionalHaikuImagePackage
                                
$(baseURL)/apr-1.4.6-r1a4-x86-gcc4-2012-08-30.zip
-                               : : true ;
+                               : : cdPackage ;
                } else {
                        InstallOptionalHaikuImagePackage
                                $(hpkgBaseURL)/apr-1.4.6-6-x86_gcc2.hpkg ;
@@ -140,7 +140,7 @@ if [ IsOptionalHaikuImagePackageAdded APR ] {
        } else if $(TARGET_ARCH) = x86_64 {
                InstallOptionalHaikuImagePackage
                        $(baseURL)/apr-1.4.6-x86_64-2012-12-08.zip
-                       : : true ;
+                       : : cdPackage ;
        } else {
                Echo "No optional package APR available for $(TARGET_ARCH)" ;
        }
@@ -153,7 +153,7 @@ if [ IsOptionalHaikuImagePackageAdded APR-util ] {
                if $(HAIKU_GCC_VERSION[1]) >= 4 {
                        InstallOptionalHaikuImagePackage
                                
$(baseURL)/apr-util-1.4.1-r1a4-x86-gcc4-2012-08-30.zip
-                               : : true ;
+                               : : cdPackage ;
                } else {
                        InstallOptionalHaikuImagePackage
                                $(hpkgBaseURL)/apr_util-1.4.1-2-x86_gcc2.hpkg ;
@@ -161,7 +161,7 @@ if [ IsOptionalHaikuImagePackageAdded APR-util ] {
        } else if $(TARGET_ARCH) = x86_64 {
                InstallOptionalHaikuImagePackage
                        $(baseURL)/apr-util-1.4.1-x86_64-2012-12-08.zip
-                       : : true ;
+                       : : cdPackage ;
        } else {
                Echo "No optional package APR-util available for 
$(TARGET_ARCH)" ;
        }
@@ -362,7 +362,7 @@ if [ IsOptionalHaikuImagePackageAdded Bzip ] {
                if $(HAIKU_GCC_VERSION[1]) >= 4 {
                        InstallOptionalHaikuImagePackage
                                
$(baseURL)/bzip2-1.0.6-r1a4-x86-gcc4-2012-08-30.zip
-                               : : true ;
+                               : : cdPackage ;
                } else {
                        InstallOptionalHaikuImagePackage
                                $(hpkgBaseURL)/bzip2-1.0.6-2-x86_gcc2.hpkg ;
@@ -370,7 +370,7 @@ if [ IsOptionalHaikuImagePackageAdded Bzip ] {
        } else if $(TARGET_ARCH) = x86_64 {
                InstallOptionalHaikuImagePackage
                        $(baseURL)/bzip2-1.0.6-x86_64-2012-08-16.zip
-                       : : true ;
+                       : : cdPackage ;
        } else {
                Echo "No optional package Bzip available for $(TARGET_ARCH)" ;
        }
@@ -398,10 +398,10 @@ if [ IsOptionalHaikuImagePackageAdded Caya ] {
                if $(HAIKU_GCC_VERSION[1]) >= 4 {
                        InstallOptionalHaikuImagePackage
                                $(baseURL)/caya-279-r1a4-x86-gcc4-2012-10-02.zip
-                               : : true ;
+                               : : cdPackage ;
                        InstallOptionalHaikuImagePackage
                                
$(baseURL)/caya-gpl-protocols-36-r1a4-x86-gcc4-2012-10-01.zip
-                               : : true ;
+                               : : cdPackage ;
                        AddSymlinkToHaikuImage home config be Applications
                                : /boot/apps/Caya/Caya ;
                } else {
@@ -488,7 +488,7 @@ if [ IsOptionalHaikuImagePackageAdded CLucene ] {
        } else {
                InstallOptionalHaikuImagePackage
                        $(baseURL)/clucene-0.9.21-x86-gcc4-haiku-2009-08-11.zip
-                       : : true ;
+                       : : cdPackage ;
        }
 }
 
@@ -501,7 +501,7 @@ if [ IsOptionalHaikuImagePackageAdded CMake ] {
                if $(HAIKU_GCC_VERSION[1]) >= 4 {
                        InstallOptionalHaikuImagePackage
                                
$(baseURL)/cmake-2.8.5-r1a4-x86-gcc4-2012-08-28.zip
-                               : : true ;
+                               : : cdPackage ;
                } else {
                        InstallOptionalHaikuImagePackage
                                $(hpkgBaseURL)/cmake-2.8.5-3-x86_gcc2.hpkg ;
@@ -534,7 +534,7 @@ if [ IsOptionalHaikuImagePackageAdded Ctags ] {
                if $(HAIKU_GCC_VERSION[1]) >= 4 {
                        InstallOptionalHaikuImagePackage
                                
$(baseURL)/ctags-5.8-r1a4-x86-gcc4-2012-08-30.zip
-                               : : true ;
+                               : : cdPackage ;
                } else {
                        InstallOptionalHaikuImagePackage
                                $(hpkgBaseURL)/ctags-5.8-2-x86_gcc2.hpkg ;
@@ -542,7 +542,7 @@ if [ IsOptionalHaikuImagePackageAdded Ctags ] {
        } else if $(TARGET_ARCH) = x86_64 {
                InstallOptionalHaikuImagePackage
                        $(baseURL)/ctags-5.8-x86_64-2012-12-08.zip
-                       : : true ;
+                       : : cdPackage ;
        } else {
                Echo "No optional package Ctags available for $(TARGET_ARCH)" ;
        }
@@ -574,7 +574,7 @@ if [ IsOptionalHaikuImagePackageAdded CVS ] {
                if $(HAIKU_GCC_VERSION[1]) >= 4 {
                        InstallOptionalHaikuImagePackage
                                
$(baseURL)/cvs-1.12.13.1-r1a4-x86-gcc4-2012-08-30.zip
-                               : : true ;
+                               : : cdPackage ;
                } else {
                        InstallOptionalHaikuImagePackage
                                $(hpkgBaseURL)/cvs-1.12.13.1-4-x86_gcc2.hpkg ;
@@ -582,7 +582,7 @@ if [ IsOptionalHaikuImagePackageAdded CVS ] {
        } else if $(TARGET_ARCH) = x86_64 {
                InstallOptionalHaikuImagePackage
                        $(baseURL)/cvs-1.12.13.1-x86_64-2012-12-18.zip
-                       : : true ;
+                       : : cdPackage ;
        } else {
                Echo "No optional package CVS available for $(TARGET_ARCH)" ;
        }
@@ -626,16 +626,16 @@ if [ IsOptionalHaikuImagePackageAdded Development ] {
                if $(HAIKU_GCC_VERSION[1]) >= 4 {
                        InstallOptionalHaikuImagePackage
                                $(baseURL)/autoconf-2.69-x86-gcc4-2013-02-16.zip
-                               : : true ;
+                               : : cdPackage ;
                        InstallOptionalHaikuImagePackage
                                
$(baseURL)/automake-1.13.1-x86-gcc4-2013-02-16.zip
-                               : : true ;
+                               : : cdPackage ;
                        InstallOptionalHaikuImagePackage
                                
$(baseURL)/libtool-2.4-r1a4-x86-gcc4-2012-08-28.zip
-                               : : true ;
+                               : : cdPackage ;
                        InstallOptionalHaikuImagePackage
                                
$(baseURL)/texinfo-4.13a-r1a4-x86-gcc4-2012-08-30.zip
-                               : : true ;
+                               : : cdPackage ;
                } else {
                        InstallOptionalHaikuImagePackage
                                $(hpkgBaseURL)/autoconf-2.69-3-x86_gcc2.hpkg ;
@@ -651,16 +651,16 @@ if [ IsOptionalHaikuImagePackageAdded Development ] {
                        : /boot/system/apps/Debugger : Debugger ;
                InstallOptionalHaikuImagePackage
                        $(baseURL)/autoconf-2.69-x86_64-2013-02-16.zip
-                       : : true ;
+                       : : cdPackage ;
                InstallOptionalHaikuImagePackage
                        $(baseURL)/automake-1.13.1-x86_64-2013-02-16.zip
-                       : : true ;
+                       : : cdPackage ;
                InstallOptionalHaikuImagePackage
                        $(baseURL)/libtool-2.4.2-x86_64-2012-08-17.zip
-                       : : true ;
+                       : : cdPackage ;
                InstallOptionalHaikuImagePackage
                        $(baseURL)/texinfo-4.13a-x86_64-2012-08-17.zip
-                       : : true ;
+                       : : cdPackage ;
        }
 }
 
@@ -799,7 +799,7 @@ if [ IsOptionalHaikuImagePackageAdded Doxygen ] {
                if $(HAIKU_GCC_VERSION[1]) >= 4 {
                        InstallOptionalHaikuImagePackage
                                
$(baseURL)/doxygen-1.6.3-r1a4-x86-gcc4-2012-09-04.zip
-                               : : true ;
+                               : : cdPackage ;
                } else {
                        InstallOptionalHaikuImagePackage
                                $(hpkgBaseURL)/doxygen-1.6.3-2-x86_gcc2.hpkg ;
@@ -821,7 +821,7 @@ if [ IsOptionalHaikuImagePackageAdded Expat ] {
                if $(HAIKU_GCC_VERSION[1]) >= 4 {
                        InstallOptionalHaikuImagePackage
                                
$(baseURL)/expat-2.0.1-r1a4-x86-gcc4-2012-08-30.zip
-                               : : true ;
+                               : : cdPackage ;
                } else {
                        InstallOptionalHaikuImagePackage
                                $(hpkgBaseURL)/expat-2.0.1-5-x86_gcc2.hpkg ;
@@ -829,7 +829,7 @@ if [ IsOptionalHaikuImagePackageAdded Expat ] {
        } else if $(TARGET_ARCH) = x86_64 {
                InstallOptionalHaikuImagePackage
                        $(baseURL)/expat-2.0.1-x86_64-2012-12-08.zip
-                       : : true ;
+                       : : cdPackage ;
        } else {
                Echo "No optional package Expat available for $(TARGET_ARCH)" ;
        }
@@ -879,7 +879,7 @@ if [ IsOptionalHaikuImagePackageAdded GetText ] {
                if $(HAIKU_GCC_VERSION[1]) >= 4 {
                        InstallOptionalHaikuImagePackage
                                
$(baseURL)/gettext-0.18.1.1-r1a4-x86-gcc4-2012-08-30.zip
-                               : : true ;
+                               : : cdPackage ;
                } else {
                        InstallOptionalHaikuImagePackage
                                $(hpkgBaseURL)/gettext-0.18.1.1-3-x86_gcc2.hpkg 
;
@@ -887,7 +887,7 @@ if [ IsOptionalHaikuImagePackageAdded GetText ] {
        } else if $(TARGET_ARCH) = x86_64 {
                InstallOptionalHaikuImagePackage
                        $(baseURL)/gettext-0.18.1.1-x86_64-2012-08-17.zip
-                       : : true ;
+                       : : cdPackage ;
        } else {
                Echo "No optional package GetText available for $(TARGET_ARCH)" 
;
        }
@@ -900,7 +900,7 @@ if [ IsOptionalHaikuImagePackageAdded Git ] {
                if $(HAIKU_GCC_VERSION[1]) >= 4 {
                        InstallOptionalHaikuImagePackage
                                
$(baseURL)/git-1.7.10.2-r1a4-x86-gcc4-2012-08-30.zip
-                               : : true ;
+                               : : cdPackage ;
                } else {
                        InstallOptionalHaikuImagePackage
                                $(hpkgBaseURL)/git-1.7.5-1-x86_gcc2.hpkg ;
@@ -908,7 +908,7 @@ if [ IsOptionalHaikuImagePackageAdded Git ] {
        } else if $(TARGET_ARCH) = x86_64 {
                InstallOptionalHaikuImagePackage
                        $(baseURL)/git-1.8.0-x86_64-2012-12-29.zip
-                       : : true ;
+                       : : cdPackage ;
        } else {
                Echo "No optional package Git available for $(TARGET_ARCH)" ;
        }
@@ -921,16 +921,16 @@ if [ IsOptionalHaikuImagePackageAdded GitDoc ] {
                if $(HAIKU_GCC_VERSION[1]) >= 4 {
                        InstallOptionalHaikuImagePackage
                                
$(baseURL)/gitdoc-1.7.10.2-r1a4-x86-gcc4-2012-09-03.zip
-                               : : true ;
+                               : : cdPackage ;
                } else {
                        InstallOptionalHaikuImagePackage
                                
$(baseURL)/gitdoc-1.7.10.2-r1a4-x86-gcc2-2012-08-28.zip
-                               : : true ;
+                               : : cdPackage ;
                }
        } else if $(TARGET_ARCH) = x86_64 {
                InstallOptionalHaikuImagePackage
                        $(baseURL)/gitdoc-1.8.0-x86_64-2012-12-18.zip
-                       : : true ;
+                       : : cdPackage ;
        } else {
                Echo "No optional package GitDoc available for $(TARGET_ARCH)" ;
        }
@@ -943,16 +943,16 @@ if [ IsOptionalHaikuImagePackageAdded GPerf ] {
                if $(HAIKU_GCC_VERSION[1]) >= 4 {
                        InstallOptionalHaikuImagePackage
                                
$(baseURL)/gperf-3.0.4-r1a4-x86-gcc4-2012-08-30.zip
-                               : : true ;
+                               : : cdPackage ;
                } else {
                        InstallOptionalHaikuImagePackage
                                
$(baseURL)/gperf-3.0.4-r1a4-x86-gcc2-2012-08-28.zip
-                               : : true ;
+                               : : cdPackage ;
                }
        } else if $(TARGET_ARCH) = x86_64 {
                InstallOptionalHaikuImagePackage
                        $(baseURL)/gperf-3.0.4-x86_64-2012-12-08.zip
-                       : : true ;
+                       : : cdPackage ;
        } else {
                Echo "No optional package GPerf available for $(TARGET_ARCH)" ;
        }
@@ -965,7 +965,7 @@ if [ IsOptionalHaikuImagePackageAdded Groff ] {
                if $(HAIKU_GCC_VERSION[1]) >= 4 {
                        InstallOptionalHaikuImagePackage
                                
$(baseURL)/groff-1.20.1-r1a4-x86-gcc4-2012-08-30.zip
-                               : : true ;
+                               : : cdPackage ;
                } else {
                        InstallOptionalHaikuImagePackage
                                $(hpkgBaseURL)/groff-1.20.1-1-x86_gcc2.hpkg ;
@@ -973,7 +973,7 @@ if [ IsOptionalHaikuImagePackageAdded Groff ] {
        } else if $(TARGET_ARCH) = x86_64 {
                InstallOptionalHaikuImagePackage
                        $(baseURL)/groff-1.20.1-x86_64-2012-12-08.zip
-                       : : true ;
+                       : : cdPackage ;
        } else {
                Echo "No optional package Groff available for $(TARGET_ARCH)" ;
        }
@@ -992,7 +992,7 @@ if [ IsOptionalHaikuImagePackageAdded Grep ] {
        } else if $(TARGET_ARCH) = x86_64 {
                InstallOptionalHaikuImagePackage
                        $(baseURL)/grep-2.14-x86_64-2012-12-28.zip
-                       : : true ;
+                       : : cdPackage ;
        } else {
                Echo "No optional package Grep available for $(TARGET_ARCH)" ;
        }
@@ -1051,7 +1051,7 @@ if [ IsOptionalHaikuImagePackageAdded KeymapSwitcher ] {
                if $(HAIKU_GCC_VERSION[1]) >= 4 {
                        InstallOptionalHaikuImagePackage
                                
$(baseURL)/KeymapSwitcher-1.2.7-x86-gcc4-2013-01-08.zip
-                               : : : false ;
+                               : : !stripDebugSymbols ;
                } else {
                        InstallOptionalHaikuImagePackage
                                
$(hpkgBaseURL)/keymapswitcher-1.2.7.9-2-x86_gcc2.hpkg ;
@@ -1061,7 +1061,7 @@ if [ IsOptionalHaikuImagePackageAdded KeymapSwitcher ] {
        } else if $(TARGET_ARCH) = x86_64 {
                InstallOptionalHaikuImagePackage
                        $(baseURL)/KeymapSwitcher-1.2.7-x86_64-2013-01-08.zip
-                       : : true ;
+                       : : cdPackage ;
                AddSymlinkToHaikuImage home config settings deskbar Preferences
                        : /boot/common/bin/KeymapSwitcher ;
        } else {
@@ -1102,16 +1102,16 @@ if [ IsOptionalHaikuImagePackageAdded LibEvent ] {
                if $(HAIKU_GCC_VERSION[1]) >= 4 {
                        InstallOptionalHaikuImagePackage
                                
$(baseURL)/libevent-2.0.10-r1a4-x86-gcc4-2012-08-30.zip
-                               : : true ;
+                               : : cdPackage ;
                } else {
                        InstallOptionalHaikuImagePackage
                                
$(baseURL)/libevent-2.0.10-r1a4-x86-gcc2-2012-08-28.zip
-                               : : true ;
+                               : : cdPackage ;
                }
        } else if $(TARGET_ARCH) = x86_64 {
                InstallOptionalHaikuImagePackage
                        $(baseURL)/libevent-2.0.10-x86_64-2012-12-08.zip
-                       : : true ;
+                       : : cdPackage ;
        } else {
                Echo "No optional package LibEvent available for 
$(TARGET_ARCH)" ;
        }
@@ -1206,7 +1206,7 @@ if [ IsOptionalHaikuImagePackageAdded LibXSLT ] {
        } else {
                InstallOptionalHaikuImagePackage
                        $(baseURL)/libxslt-1.1.26-r1a4-x86-gcc2-2012-08-28.zip
-                       : : true ;
+                       : : cdPackage ;
        }
 }
 
@@ -1237,11 +1237,11 @@ if [ IsOptionalHaikuImagePackageAdded Lua ] {
                if $(HAIKU_GCC_VERSION[1]) >= 4 {
                        InstallOptionalHaikuImagePackage
                                
$(baseURL)/lua-5.1.4-3-r1a4-x86-gcc4-2012-09-01.zip
-                               : : true ;
+                               : : cdPackage ;
                } else {
                        InstallOptionalHaikuImagePackage
                                
$(baseURL)/lua-5.1.4-3-r1a4-x86-gcc2-2012-09-01.zip
-                               : : true ;
+                               : : cdPackage ;
                }
        }
 }
@@ -1273,7 +1273,7 @@ if [ IsOptionalHaikuImagePackageAdded Mercurial ] {
                if $(HAIKU_GCC_VERSION[1]) >= 4 {
                        InstallOptionalHaikuImagePackage
                                
$(baseURL)/mercurial-2.2.2-r1a4-x86-gcc4-2012-08-30.zip
-                               : : true ;
+                               : : cdPackage ;
                } else {
                        InstallOptionalHaikuImagePackage
                                $(hpkgBaseURL)/mercurial-2.2.2-2-x86_gcc2.hpkg ;
@@ -1281,7 +1281,7 @@ if [ IsOptionalHaikuImagePackageAdded Mercurial ] {
        } else if $(TARGET_ARCH) = x86_64 {
                InstallOptionalHaikuImagePackage
                        $(baseURL)/mercurial-2.4-x86_64-2012-12-18.zip
-                       : : true ;
+                       : : cdPackage ;
        } else {
                Echo "No optional package Mercurial available for 
$(TARGET_ARCH)" ;
        }
@@ -1552,7 +1552,7 @@ if [ IsOptionalHaikuImagePackageAdded Perl ] {
                if $(HAIKU_GCC_VERSION[1]) >= 4 {
                        InstallOptionalHaikuImagePackage
                                
$(baseURL)/perl-5.10.1-r1a4-x86-gcc4-2012-10-17.zip
-                               : : true ;
+                               : : cdPackage ;
                } else {
                        InstallOptionalHaikuImagePackage
                                $(hpkgBaseURL)/perl-5.10.1-4-x86_gcc2.hpkg ;
@@ -1560,7 +1560,7 @@ if [ IsOptionalHaikuImagePackageAdded Perl ] {
        } else if $(TARGET_ARCH) = x86_64 {
                InstallOptionalHaikuImagePackage
                        $(baseURL)/perl-5.10.1-x86_64-2012-08-17.zip
-                       : : true ;
+                       : : cdPackage ;
        } else {
                Echo "No optional package Perl available for $(TARGET_ARCH)" ;
        }
@@ -1588,7 +1588,7 @@ if [ IsOptionalHaikuImagePackageAdded Python ] {
                if $(HAIKU_GCC_VERSION[1]) >= 4 {
                        InstallOptionalHaikuImagePackage
                                
$(baseURL)/python-2.6.8-r1a4-x86-gcc4-2012-09-03.zip
-                               : : true ;
+                               : : cdPackage ;
                } else {
                        InstallOptionalHaikuImagePackage
                                $(hpkgBaseURL)/python-2.6.8-3-x86_gcc2.hpkg ;
@@ -1596,7 +1596,7 @@ if [ IsOptionalHaikuImagePackageAdded Python ] {
        } else if $(TARGET_ARCH) = x86_64 {
                InstallOptionalHaikuImagePackage
                        $(baseURL)/python-2.6.8-x86_64-2012-11-28.zip
-                       : : true ;
+                       : : cdPackage ;
        } else {
                Echo "No optional package Python available for $(TARGET_ARCH)" ;
        }
@@ -1626,11 +1626,11 @@ if [ IsOptionalHaikuImagePackageAdded Rsync ] {
                if $(HAIKU_GCC_VERSION[1]) >= 4 {
                        InstallOptionalHaikuImagePackage
                                
$(baseURL)/rsync-3.0.7-r1a4-x86-gcc4-2012-09-09.zip
-                               : : true ;
+                               : : cdPackage ;
                } else {
                        InstallOptionalHaikuImagePackage
                                
$(baseURL)/rsync-3.0.7-r1a4-x86-gcc2-2012-09-12.zip
-                               : : true ;
+                               : : cdPackage ;
                }
        }
 }
@@ -1694,7 +1694,7 @@ if [ IsOptionalHaikuImagePackageAdded Subversion ] {
                if $(HAIKU_GCC_VERSION[1]) >= 4 {
                        InstallOptionalHaikuImagePackage
                                
$(baseURL)/subversion-1.6.18-r1a4-x86-gcc4-2012-08-30.zip
-                               : : true ;
+                               : : cdPackage ;
                } else {
                        InstallOptionalHaikuImagePackage
                                
$(hpkgBaseURL)/subversion-1.6.18-4-x86_gcc2.hpkg ;
@@ -1702,7 +1702,7 @@ if [ IsOptionalHaikuImagePackageAdded Subversion ] {
        } else if $(TARGET_ARCH) = x86_64 {
                InstallOptionalHaikuImagePackage
                        $(baseURL)/subversion-1.6.18-x86_64-2012-12-18.zip
-                       : : true ;
+                       : : cdPackage ;
        } else {
                Echo "No optional package Subversion available for 
$(TARGET_ARCH)" ;
        }
@@ -1766,11 +1766,11 @@ if [ IsOptionalHaikuImagePackageAdded Transmission ] {
                if $(HAIKU_GCC_VERSION[1]) >= 4 {
                        InstallOptionalHaikuImagePackage
                                
$(baseURL)/transmission-2.21-r1a4-x86-gcc4-2012-09-12.zip
-                               : : true ;
+                               : : cdPackage ;
                } else {
                        InstallOptionalHaikuImagePackage
                                
$(baseURL)/transmission-2.21-r1a4-x86-gcc2-2012-09-05.zip
-                               : : true ;
+                               : : cdPackage ;
                }
        }
 }
@@ -1782,16 +1782,16 @@ if [ IsOptionalHaikuImagePackageAdded UnRAR ] {
                if $(HAIKU_GCC_VERSION[1]) >= 4 {
                        InstallOptionalHaikuImagePackage
                                $(baseURL)/UnRAR-4.2.4-x86-gcc4-2013-01-21.zip
-                               : : true ;
+                               : : cdPackage ;
                } else {
                        InstallOptionalHaikuImagePackage
                                $(baseURL)/UnRAR-4.2.4-x86-gcc2-2013-01-21.zip
-                               : : true ;
+                               : : cdPackage ;
                }
        } else if $(TARGET_ARCH) = x86_64 {
                InstallOptionalHaikuImagePackage
                        $(baseURL)/UnRAR-4.2.4-x86_64-2013-01-21.zip
-                       : : true ;
+                       : : cdPackage ;
        } else {
                Echo "No optional package UnRAR available for $(TARGET_ARCH)" ;
        }
@@ -1856,18 +1856,18 @@ if [ IsOptionalHaikuImagePackageAdded Vim ] {
                if $(HAIKU_GCC_VERSION[1]) >= 4 {
                        InstallOptionalHaikuImagePackage
                                $(baseURL)/vim-7.3-r1a4-x86-gcc4-2012-09-26.zip
-                               : : true ;
+                               : : cdPackage ;
                } else {
                        InstallOptionalHaikuImagePackage
                                $(baseURL)/vim-7.3-r1a4-x86-gcc2-2012-09-26.zip
-                               : : true ;
+                               : : cdPackage ;
                }
                AddSymlinkToHaikuImage home config settings deskbar Applications
                        : /boot/common/bin/gvim ;
        } else if $(TARGET_ARCH) = x86_64 {
                InstallOptionalHaikuImagePackage
                        $(baseURL)/vim-7.3-x86_64-2013-01-19.zip
-                       : : true ;
+                       : : cdPackage ;
                AddSymlinkToHaikuImage home config settings deskbar Applications
                        : /boot/common/bin/gvim ;
        } else {
@@ -2016,7 +2016,7 @@ if [ IsOptionalHaikuImagePackageAdded wpa_supplicant ] {
        } else if $(HAIKU_GCC_VERSION[1]) >= 4 {
                InstallOptionalHaikuImagePackage
                        $(baseURL)/wpa_supplicant-2.0-x86-gcc4-2013-03-31.zip
-                       : : : false ;
+                       : : !stripDebugSymbols ;
        } else {
                InstallOptionalHaikuImagePackage
                        $(hpkgBaseURL)/wpa_supplicant-0.7.3-2-x86_gcc2.hpkg
diff --git a/build/jam/PackageRules b/build/jam/PackageRules
index 00af450..a35b578 100644
--- a/build/jam/PackageRules
+++ b/build/jam/PackageRules
@@ -376,18 +376,18 @@ rule AddSymlinkToPackage directoryTokens : linkTarget : 
linkName
 
 
 rule CopyDirectoryToPackage directoryTokens : sourceDirectory
-       : targetDirectoryName : excludePatterns : alwaysUpdate
+       : targetDirectoryName : excludePatterns : flags
 {
        CopyDirectoryToContainer $(HAIKU_CURRENTLY_BUILT_HAIKU_PACKAGE)
                : $(directoryTokens) : $(sourceDirectory) : 
$(targetDirectoryName)
-               : $(excludePatterns) : $(alwaysUpdate) ;
+               : $(excludePatterns) : $(flags) ;
 }
 
 
-rule AddHeaderDirectoryToPackage dirTokens : dirName : alwaysUpdate
+rule AddHeaderDirectoryToPackage dirTokens : dirName : flags
 {
        AddHeaderDirectoryToContainer $(HAIKU_CURRENTLY_BUILT_HAIKU_PACKAGE)
-               : $(dirTokens) : $(dirName) : $(alwaysUpdate) ;
+               : $(dirTokens) : $(dirName) : $(flags) ;
 }
 
 
@@ -399,11 +399,10 @@ rule AddWifiFirmwareToPackage driver : subDirToExtract : 
archive
 }
 
 
-rule ExtractArchiveToPackage dirTokens : archiveFile : alwaysUpdate
-       : extractedSubDir
+rule ExtractArchiveToPackage dirTokens : archiveFile : flags : extractedSubDir
 {
        ExtractArchiveToContainer $(HAIKU_CURRENTLY_BUILT_HAIKU_PACKAGE)
-               : $(dirTokens) : $(archiveFile) : $(alwaysUpdate) : 
$(extractedSubDir) ;
+               : $(dirTokens) : $(archiveFile) : $(flags) : $(extractedSubDir) 
;
 }
 
 
diff --git a/build/jam/UserBuildConfig.ReadMe b/build/jam/UserBuildConfig.ReadMe
index be0ac6e..53ff677 100644
--- a/build/jam/UserBuildConfig.ReadMe
+++ b/build/jam/UserBuildConfig.ReadMe
@@ -109,7 +109,7 @@ AddFilesToHaikuImage home config settings : 
<keymap>US-International : Key_map ;
 # Note that the second directory will also be copied, if the image will only
 # be updated; the first one won't in that case.
 AddSourceDirectoryToHaikuImage src/kits/storage ;
-AddSourceDirectoryToHaikuImage src/tests/servers/debug : 1 ;
+AddSourceDirectoryToHaikuImage src/tests/servers/debug : alwaysUpdate ;
 
 # Copy the jam sources (assuming they are located ../buildtools/jam relatively
 # to your Haiku sources) to the image as /boot/home/Desktop/jam-src, excluding

############################################################################

Commit:      d6a6e2c811bf9f4f30c8000b54a199e57d8a25ed
Author:      Ingo Weinhold <ingo_weinhold@xxxxxx>
Date:        Tue May  7 01:13:37 2013 UTC

rule CopyDirectoryToContainer: Add flags isTarget

The flags indicates that the passed sourceDirectory is a target, not a
path.

----------------------------------------------------------------------------

diff --git a/build/jam/ImageRules b/build/jam/ImageRules
index 20036e1..be029ca 100644
--- a/build/jam/ImageRules
+++ b/build/jam/ImageRules
@@ -318,7 +318,8 @@ rule CopyDirectoryToContainer container : directoryTokens : 
sourceDirectory
        #       : <sourceDirectory> : <targetDirectoryName> : <excludePatterns>
        #       [ : <flags> ] ;
        #
-       # Supported flags: alwaysUpdate
+       # Supported flags: alwaysUpdate, isTarget
+       # isTarget: <sourceDirectory> is a target, not a path
 
        # If the image shall only be updated, we don't copy any directories
        if [ on $(container) return $(HAIKU_CONTAINER_UPDATE_ONLY) ]
@@ -328,14 +329,22 @@ rule CopyDirectoryToContainer container : directoryTokens 
: sourceDirectory
        }
 
        if ! $(targetDirectoryName) {
-               local path = [ FReverse [ FSplitPath $(sourceDirectory) ] ] ;
-               targetDirectoryName = $(path[1]) ;
+               targetDirectoryName = $(sourceDirectory[1]:BS) ;
+       }
+
+       # If sourceDirectory is a path, not a target, make it a target, so we 
can
+       # tree them the same way.
+       if ! isTarget in $(flags) {
+               sourceDirectory = 
$(sourceDirectory:G=copy-directory-to-container) ;
+               SEARCH on $(sourceDirectory) = ;
+               TARGET on $(sourceDirectory) = ;
        }
 
        local directory = [ AddDirectoryToContainer $(container)
                : $(directoryTokens) $(targetDirectoryName) ] ;
 
        local targetDir = $(directory)/-/$(sourceDirectory) ;
+       Depends $(targetDir) : $(sourceDirectory) ;
        EXCLUDE_PATTERNS on $(targetDir) = $(excludePatterns) ;
        SOURCE_DIRECTORY on $(targetDir) = $(sourceDirectory) ;
        TARGET_DIRECTORY on $(targetDir) = $(directory) ;
@@ -719,7 +728,7 @@ actions AddSymlinkToContainerCopyFilesScript
 }
 
 
-actions AddDirectoryToContainerCopyFilesScript
+actions AddDirectoryToContainerCopyFilesScript bind SOURCE_DIRECTORY
 {
        echo \$cp -r $(EXCLUDE_PATTERNS) "\"\${sPrefix}$(SOURCE_DIRECTORY)/.\"" 
\
                "\"\${tPrefix}$(TARGET_DIRECTORY:G=)\"" >> $(2[1])

############################################################################

Commit:      e387e24faa576987379b6d5b9da4dd054a9d7589
Author:      Ingo Weinhold <ingo_weinhold@xxxxxx>
Date:        Tue May  7 02:06:20 2013 UTC

Move MIME DB creation from build_haiku_image to jam build system

* build_haiku_image: Remove MIME DB creation code.
* Rename beos_mime source directory to mime_db.
* Add rules to build the MIME DB in the source directory's jamfile.
* Add MIME DB directory to haiku.hpkg in data/mime_db.

----------------------------------------------------------------------------

diff --git a/build/jam/packages/Haiku b/build/jam/packages/Haiku
index 46cc640..304485c 100644
--- a/build/jam/packages/Haiku
+++ b/build/jam/packages/Haiku
@@ -352,6 +352,10 @@ AddFilesToPackage add-ons disk_systems
        : <disk_system>intel <disk_system>gpt <disk_system>bfs 
<disk_system>ntfs ;
 
 
+# the MIME DB
+CopyDirectoryToPackage data : <mimedb>mime_db : : : isTarget ;
+
+
 # optional
 # TODO: We should probably build another package (including the data files
 # above) that can be installed, if desired.
diff --git a/build/scripts/build_haiku_image b/build/scripts/build_haiku_image
index d1b3091..df4b085 100755
--- a/build/scripts/build_haiku_image
+++ b/build/scripts/build_haiku_image
@@ -295,59 +295,6 @@ for packageFile in $packages; do
 done
 
 
-# install MIME database
-# TODO: It should be possible to do that in the build system too.
-
-if [ ! $updateOnly ]; then
-       mimeDBSource=$sourceDir/src/data/beos_mime
-       mimeDBDest=${tPrefix}home/config/settings/beos_mime
-
-       echo "Deleting old MIME database ..."
-
-       $rm -rf $mimeDBDest
-       $mkdir -p $mimeDBDest
-       mimeTmpDir=$tmpDir/mime
-       mimeDBTmpDir=$tmpDir/mime/db
-       mimeTmpIndex=0
-       mimeTmpFile=$mimeTmpDir/mimedb$$.rsrc
-
-       # create tmp dir for the MIME conversion stuff
-       mkdir -p $mimeDBTmpDir
-
-       echo "Installing MIME database ..."
-
-       for inSuperFile in $mimeDBSource/*.super; do
-               superType=$(basename $inSuperFile .super)
-               tmpSuperDir=$mimeDBTmpDir/$superType
-
-               # compile rdef to rsrc file and the rsrc file to attributes
-               $rc -o $mimeTmpFile $inSuperFile
-               mkdir -p $tmpSuperDir
-               $resattr -O -o $tmpSuperDir $mimeTmpFile
-               $rmAttrs $mimeTmpFile
-
-               # iterate through the sub types
-               for inSubFile in $mimeDBSource/$superType/*; do
-                       # check, if the type exists
-                       if test -f $inSubFile && grep META:TYPE $inSubFile > 
/dev/null 2>&1 ; then
-                               subType=$(basename $inSubFile)
-                               tmpSubFile=$mimeDBTmpDir/$superType/$subType
-
-                               # compile rdef to rsrc file and the rsrc file 
to attributes
-                               $rc -o $mimeTmpFile $inSubFile
-                               $resattr -O -o $tmpSubFile $mimeTmpFile
-                               $rmAttrs $mimeTmpFile
-                       fi
-               done
-       done
-
-       $cp -r ${sPrefix}$mimeDBTmpDir/. $mimeDBDest
-
-       # cleanup tmp dir
-       $rmAttrs -rf $mimeTmpDir
-fi     # ! updateOnly
-
-
 # add the concatenated copyrights as an attribute to AboutSystem
 # TODO: That might not be necessary, when all third-party software everything
 # is packaged. Though we might not package everything.
diff --git a/src/data/Jamfile b/src/data/Jamfile
index ff84753..96c7908 100644
--- a/src/data/Jamfile
+++ b/src/data/Jamfile
@@ -2,4 +2,5 @@ SubDir HAIKU_TOP src data ;
 
 HaikuSubInclude etc ;
 HaikuSubInclude keymaps ;
+HaikuSubInclude mime_db ;
 HaikuSubInclude settings ;
diff --git a/src/data/mime_db/Jamfile b/src/data/mime_db/Jamfile
new file mode 100644
index 0000000..d35cb72
--- /dev/null
+++ b/src/data/mime_db/Jamfile
@@ -0,0 +1,107 @@
+SubDir HAIKU_TOP src data mime_db ;
+
+
+rule BuildMimeDB superTypes
+{
+       local mimeDB = <mimedb>mime_db ;
+       MakeLocateCommonPlatform $(mimeDB) ;
+
+       # make the supertypes
+       local compiledSuperTypes ;
+       local superType ;
+       for superType in $(superTypes) {
+               local compiledSuperType = $(superType:S=.rsrc:G=mimedb-super) ;
+               ResComp $(compiledSuperType) : $(superType) ;
+               compiledSuperTypes += $(compiledSuperType) ;
+       }
+
+       Depends $(mimeDB) : <build>resattr $(compiledSuperTypes) ;
+       BuildMimeDBSuperTypes $(mimeDB) : <build>resattr $(compiledSuperTypes) ;
+
+       # make the subtypes for each supertype
+       for superType in $(superTypes) {
+               local subTypes = [ on $(superType) return 
$(HAIKU_MIMEDB_SUBTYPES) ] ;
+               local compiledSubTypes ;
+               for subType in $(subTypes) {
+                       local compiledSubType = $(subType:BS).rsrc ;
+                               # Note: The subtype name may contain '.'s. 
Hence we cannot use
+                               # ":S=.rsrc".
+                       compiledSubType = 
$(compiledSubType:G=mimedb-sub-$(superType:B)) ;
+                       ResComp $(compiledSubType) : $(subType) ;
+                       MakeLocate $(compiledSubType)
+                               : [ FDirName $(COMMON_PLATFORM_LOCATE_TARGET) 
$(superType:B) ] ;
+                               # need to relocate to avoid clashes between 
equally named
+                               # subtypes of different supertypes
+                       compiledSubTypes += $(compiledSubType) ;
+               }
+
+               if $(compiledSubTypes) {
+                       Depends $(mimeDB) : $(superType) $(compiledSubTypes) ;
+                       BuildMimeDBSubTypes $(mimeDB)
+                               : <build>resattr $(superType) 
$(compiledSubTypes) ;
+               }
+       }
+}
+
+
+actions BuildMimeDBSuperTypes
+{
+       $(HOST_ADD_BUILD_COMPATIBILITY_LIB_DIR)
+
+       # remove and re-create the directory
+       baseDirectory="$(1)"
+       $(RM) -rf "$baseDirectory"
+       mkdir "$baseDirectory"
+
+       resattr="$(2[1])"
+
+       for sourceFile in "$(2[2-])" ; do
+               type=`basename "$sourceFile" .rsrc`
+               targetDirectory="$baseDirectory/$type"
+               mkdir "$targetDirectory"
+               "$resattr" -O -o "$targetDirectory" "$sourceFile"
+       done
+}
+
+
+actions BuildMimeDBSubTypes
+{
+       $(HOST_ADD_BUILD_COMPATIBILITY_LIB_DIR)
+
+       resattr="$(2[1])"
+       superType=`basename "$(2[2])" .super`
+       superTypeDirectory="$(1)/$superType"
+
+       for sourceFile in "$(2[3-])" ; do
+               type=`basename "$sourceFile" .rsrc`
+               targetFile="$superTypeDirectory/$type"
+               "$resattr" -O -o "$targetFile" "$sourceFile"
+       done
+}
+
+
+# glob the supertype source files
+local superTypeFiles = [ Glob $(SUBDIR) : *.super ] ;
+superTypeFiles = $(superTypeFiles:BSG=mimedb) ;
+SEARCH on $(superTypeFiles) = $(SUBDIR) ;
+
+# for each supertype glob the subtype source files
+local superType ;
+for superTypeFile in $(superTypeFiles) {
+       local superTypeDirectory = [ FDirName $(SUBDIR) $(superTypeFile:B) ] ;
+       local subTypeFiles = [ Glob $(superTypeDirectory) : * ] ;
+
+       local subTypes ;
+       local subType ;
+       for subType in $(subTypeFiles:BS) {
+               if $(subType) != "." && $(subType) != ".." {
+                       subType = $(subType:G=mimedb-sub) ;
+                       SEARCH on $(subType) = $(superTypeDirectory) ;
+                       subTypes += $(subType) ;
+               }
+       }
+
+       HAIKU_MIMEDB_SUBTYPES on $(superTypeFile) = $(subTypes) ;
+}
+
+BuildMimeDB $(superTypeFiles) ;
diff --git a/src/data/beos_mime/application.super 
b/src/data/mime_db/application.super
similarity index 100%
rename from src/data/beos_mime/application.super
rename to src/data/mime_db/application.super
diff --git a/src/data/beos_mime/application/msword 
b/src/data/mime_db/application/msword
similarity index 100%
rename from src/data/beos_mime/application/msword
rename to src/data/mime_db/application/msword
diff --git a/src/data/beos_mime/application/ogg 
b/src/data/mime_db/application/ogg
similarity index 100%
rename from src/data/beos_mime/application/ogg
rename to src/data/mime_db/application/ogg
diff --git a/src/data/beos_mime/application/pdf 
b/src/data/mime_db/application/pdf
similarity index 100%
rename from src/data/beos_mime/application/pdf
rename to src/data/mime_db/application/pdf
diff --git a/src/data/beos_mime/application/postscript 
b/src/data/mime_db/application/postscript
similarity index 100%
rename from src/data/beos_mime/application/postscript
rename to src/data/mime_db/application/postscript
diff --git a/src/data/beos_mime/application/vnd.ms-excel 
b/src/data/mime_db/application/vnd.ms-excel
similarity index 100%
rename from src/data/beos_mime/application/vnd.ms-excel
rename to src/data/mime_db/application/vnd.ms-excel
diff --git a/src/data/beos_mime/application/vnd.ms-powerpoint 
b/src/data/mime_db/application/vnd.ms-powerpoint
similarity index 100%
rename from src/data/beos_mime/application/vnd.ms-powerpoint
rename to src/data/mime_db/application/vnd.ms-powerpoint
diff --git a/src/data/beos_mime/application/vnd.ms-works 
b/src/data/mime_db/application/vnd.ms-works
similarity index 100%
rename from src/data/beos_mime/application/vnd.ms-works
rename to src/data/mime_db/application/vnd.ms-works
diff --git a/src/data/beos_mime/application/x-7z-compressed 
b/src/data/mime_db/application/x-7z-compressed
similarity index 100%
rename from src/data/beos_mime/application/x-7z-compressed
rename to src/data/mime_db/application/x-7z-compressed
diff --git a/src/data/beos_mime/application/x-bfs-image 
b/src/data/mime_db/application/x-bfs-image
similarity index 100%
rename from src/data/beos_mime/application/x-bfs-image
rename to src/data/mime_db/application/x-bfs-image
diff --git a/src/data/beos_mime/application/x-bittorrent 
b/src/data/mime_db/application/x-bittorrent
similarity index 100%
rename from src/data/beos_mime/application/x-bittorrent
rename to src/data/mime_db/application/x-bittorrent
diff --git a/src/data/beos_mime/application/x-bzip2 
b/src/data/mime_db/application/x-bzip2
similarity index 100%
rename from src/data/beos_mime/application/x-bzip2
rename to src/data/mime_db/application/x-bzip2
diff --git a/src/data/beos_mime/application/x-cd-image 
b/src/data/mime_db/application/x-cd-image
similarity index 100%
rename from src/data/beos_mime/application/x-cd-image
rename to src/data/mime_db/application/x-cd-image
diff --git a/src/data/beos_mime/application/x-font-ttf 
b/src/data/mime_db/application/x-font-ttf
similarity index 100%
rename from src/data/beos_mime/application/x-font-ttf
rename to src/data/mime_db/application/x-font-ttf
diff --git a/src/data/beos_mime/application/x-gzip 
b/src/data/mime_db/application/x-gzip
similarity index 100%
rename from src/data/beos_mime/application/x-gzip
rename to src/data/mime_db/application/x-gzip
diff --git a/src/data/beos_mime/application/x-lharc 
b/src/data/mime_db/application/x-lharc
similarity index 100%
rename from src/data/beos_mime/application/x-lharc
rename to src/data/mime_db/application/x-lharc
diff --git a/src/data/beos_mime/application/x-msaccess 
b/src/data/mime_db/application/x-msaccess
similarity index 100%
rename from src/data/beos_mime/application/x-msaccess
rename to src/data/mime_db/application/x-msaccess
diff --git a/src/data/beos_mime/application/x-person 
b/src/data/mime_db/application/x-person
similarity index 100%
rename from src/data/beos_mime/application/x-person
rename to src/data/mime_db/application/x-person
diff --git a/src/data/beos_mime/application/x-rar 
b/src/data/mime_db/application/x-rar
similarity index 100%
rename from src/data/beos_mime/application/x-rar
rename to src/data/mime_db/application/x-rar
diff --git a/src/data/beos_mime/application/x-scode-upkg 
b/src/data/mime_db/application/x-scode-upkg
similarity index 100%
rename from src/data/beos_mime/application/x-scode-upkg
rename to src/data/mime_db/application/x-scode-upkg
diff --git a/src/data/beos_mime/application/x-tar 
b/src/data/mime_db/application/x-tar
similarity index 100%
rename from src/data/beos_mime/application/x-tar
rename to src/data/mime_db/application/x-tar
diff --git a/src/data/beos_mime/application/x-vnd.be-bookmark 
b/src/data/mime_db/application/x-vnd.be-bookmark
similarity index 100%
rename from src/data/beos_mime/application/x-vnd.be-bookmark
rename to src/data/mime_db/application/x-vnd.be-bookmark
diff --git a/src/data/beos_mime/application/x-vnd.be-directory 
b/src/data/mime_db/application/x-vnd.be-directory
similarity index 100%
rename from src/data/beos_mime/application/x-vnd.be-directory
rename to src/data/mime_db/application/x-vnd.be-directory
diff --git a/src/data/beos_mime/application/x-vnd.be-elfexecutable 
b/src/data/mime_db/application/x-vnd.be-elfexecutable
similarity index 100%
rename from src/data/beos_mime/application/x-vnd.be-elfexecutable
rename to src/data/mime_db/application/x-vnd.be-elfexecutable
diff --git a/src/data/beos_mime/application/x-vnd.be-query 
b/src/data/mime_db/application/x-vnd.be-query
similarity index 100%
rename from src/data/beos_mime/application/x-vnd.be-query
rename to src/data/mime_db/application/x-vnd.be-query
diff --git a/src/data/beos_mime/application/x-vnd.be-querytemplate 
b/src/data/mime_db/application/x-vnd.be-querytemplate
similarity index 100%
rename from src/data/beos_mime/application/x-vnd.be-querytemplate
rename to src/data/mime_db/application/x-vnd.be-querytemplate
diff --git a/src/data/beos_mime/application/x-vnd.be-symlink 
b/src/data/mime_db/application/x-vnd.be-symlink
similarity index 100%
rename from src/data/beos_mime/application/x-vnd.be-symlink
rename to src/data/mime_db/application/x-vnd.be-symlink
diff --git a/src/data/beos_mime/application/x-vnd.be-volume 
b/src/data/mime_db/application/x-vnd.be-volume
similarity index 100%
rename from src/data/beos_mime/application/x-vnd.be-volume
rename to src/data/mime_db/application/x-vnd.be-volume
diff --git a/src/data/beos_mime/application/x-vnd.be.url.beshare 
b/src/data/mime_db/application/x-vnd.be.url.beshare
similarity index 100%
rename from src/data/beos_mime/application/x-vnd.be.url.beshare
rename to src/data/mime_db/application/x-vnd.be.url.beshare
diff --git a/src/data/beos_mime/application/x-vnd.be.url.file 
b/src/data/mime_db/application/x-vnd.be.url.file
similarity index 100%
rename from src/data/beos_mime/application/x-vnd.be.url.file
rename to src/data/mime_db/application/x-vnd.be.url.file
diff --git a/src/data/beos_mime/application/x-vnd.be.url.finger 
b/src/data/mime_db/application/x-vnd.be.url.finger
similarity index 100%
rename from src/data/beos_mime/application/x-vnd.be.url.finger
rename to src/data/mime_db/application/x-vnd.be.url.finger
diff --git a/src/data/beos_mime/application/x-vnd.be.url.ftp 
b/src/data/mime_db/application/x-vnd.be.url.ftp
similarity index 100%
rename from src/data/beos_mime/application/x-vnd.be.url.ftp
rename to src/data/mime_db/application/x-vnd.be.url.ftp
diff --git a/src/data/beos_mime/application/x-vnd.be.url.gopher 
b/src/data/mime_db/application/x-vnd.be.url.gopher
similarity index 100%
rename from src/data/beos_mime/application/x-vnd.be.url.gopher
rename to src/data/mime_db/application/x-vnd.be.url.gopher
diff --git a/src/data/beos_mime/application/x-vnd.be.url.http 
b/src/data/mime_db/application/x-vnd.be.url.http
similarity index 100%
rename from src/data/beos_mime/application/x-vnd.be.url.http
rename to src/data/mime_db/application/x-vnd.be.url.http
diff --git a/src/data/beos_mime/application/x-vnd.be.url.https 
b/src/data/mime_db/application/x-vnd.be.url.https
similarity index 100%
rename from src/data/beos_mime/application/x-vnd.be.url.https
rename to src/data/mime_db/application/x-vnd.be.url.https
diff --git a/src/data/beos_mime/application/x-vnd.be.url.mailto 
b/src/data/mime_db/application/x-vnd.be.url.mailto
similarity index 100%
rename from src/data/beos_mime/application/x-vnd.be.url.mailto
rename to src/data/mime_db/application/x-vnd.be.url.mailto
diff --git a/src/data/beos_mime/application/x-vnd.be.url.mms 
b/src/data/mime_db/application/x-vnd.be.url.mms
similarity index 100%
rename from src/data/beos_mime/application/x-vnd.be.url.mms
rename to src/data/mime_db/application/x-vnd.be.url.mms
diff --git a/src/data/beos_mime/application/x-vnd.be.url.news 
b/src/data/mime_db/application/x-vnd.be.url.news
similarity index 100%
rename from src/data/beos_mime/application/x-vnd.be.url.news
rename to src/data/mime_db/application/x-vnd.be.url.news
diff --git a/src/data/beos_mime/application/x-vnd.be.url.nfs 
b/src/data/mime_db/application/x-vnd.be.url.nfs
similarity index 100%
rename from src/data/beos_mime/application/x-vnd.be.url.nfs
rename to src/data/mime_db/application/x-vnd.be.url.nfs
diff --git a/src/data/beos_mime/application/x-vnd.be.url.query 
b/src/data/mime_db/application/x-vnd.be.url.query
similarity index 100%
rename from src/data/beos_mime/application/x-vnd.be.url.query
rename to src/data/mime_db/application/x-vnd.be.url.query
diff --git a/src/data/beos_mime/application/x-vnd.be.url.rsync 
b/src/data/mime_db/application/x-vnd.be.url.rsync
similarity index 100%
rename from src/data/beos_mime/application/x-vnd.be.url.rsync
rename to src/data/mime_db/application/x-vnd.be.url.rsync
diff --git a/src/data/beos_mime/application/x-vnd.be.url.rtp 
b/src/data/mime_db/application/x-vnd.be.url.rtp
similarity index 100%
rename from src/data/beos_mime/application/x-vnd.be.url.rtp
rename to src/data/mime_db/application/x-vnd.be.url.rtp
diff --git a/src/data/beos_mime/application/x-vnd.be.url.rtsp 
b/src/data/mime_db/application/x-vnd.be.url.rtsp
similarity index 100%
rename from src/data/beos_mime/application/x-vnd.be.url.rtsp
rename to src/data/mime_db/application/x-vnd.be.url.rtsp
diff --git a/src/data/beos_mime/application/x-vnd.be.url.sftp 
b/src/data/mime_db/application/x-vnd.be.url.sftp
similarity index 100%
rename from src/data/beos_mime/application/x-vnd.be.url.sftp
rename to src/data/mime_db/application/x-vnd.be.url.sftp
diff --git a/src/data/beos_mime/application/x-vnd.be.url.ssh 
b/src/data/mime_db/application/x-vnd.be.url.ssh
similarity index 100%
rename from src/data/beos_mime/application/x-vnd.be.url.ssh
rename to src/data/mime_db/application/x-vnd.be.url.ssh
diff --git a/src/data/beos_mime/application/x-vnd.be.url.telnet 
b/src/data/mime_db/application/x-vnd.be.url.telnet
similarity index 100%
rename from src/data/beos_mime/application/x-vnd.be.url.telnet
rename to src/data/mime_db/application/x-vnd.be.url.telnet
diff --git a/src/data/beos_mime/application/x-vnd.haiku-icon 
b/src/data/mime_db/application/x-vnd.haiku-icon
similarity index 100%
rename from src/data/beos_mime/application/x-vnd.haiku-icon
rename to src/data/mime_db/application/x-vnd.haiku-icon
diff --git a/src/data/beos_mime/application/x-xar 
b/src/data/mime_db/application/x-xar
similarity index 100%
rename from src/data/beos_mime/application/x-xar
rename to src/data/mime_db/application/x-xar
diff --git a/src/data/beos_mime/application/x-xz 
b/src/data/mime_db/application/x-xz
similarity index 100%
rename from src/data/beos_mime/application/x-xz
rename to src/data/mime_db/application/x-xz
diff --git a/src/data/beos_mime/application/zip 
b/src/data/mime_db/application/zip
similarity index 100%
rename from src/data/beos_mime/application/zip
rename to src/data/mime_db/application/zip
diff --git a/src/data/beos_mime/audio.super b/src/data/mime_db/audio.super
similarity index 100%
rename from src/data/beos_mime/audio.super
rename to src/data/mime_db/audio.super
diff --git a/src/data/beos_mime/audio/ac3 b/src/data/mime_db/audio/ac3
similarity index 100%
rename from src/data/beos_mime/audio/ac3
rename to src/data/mime_db/audio/ac3
diff --git a/src/data/beos_mime/audio/basic b/src/data/mime_db/audio/basic
similarity index 100%
rename from src/data/beos_mime/audio/basic
rename to src/data/mime_db/audio/basic
diff --git a/src/data/beos_mime/audio/mid b/src/data/mime_db/audio/mid
similarity index 100%
rename from src/data/beos_mime/audio/mid
rename to src/data/mime_db/audio/mid
diff --git a/src/data/beos_mime/audio/midi b/src/data/mime_db/audio/midi
similarity index 100%
rename from src/data/beos_mime/audio/midi
rename to src/data/mime_db/audio/midi
diff --git a/src/data/beos_mime/audio/mp4 b/src/data/mime_db/audio/mp4
similarity index 100%
rename from src/data/beos_mime/audio/mp4
rename to src/data/mime_db/audio/mp4
diff --git a/src/data/beos_mime/audio/mpeg b/src/data/mime_db/audio/mpeg
similarity index 100%
rename from src/data/beos_mime/audio/mpeg
rename to src/data/mime_db/audio/mpeg
diff --git a/src/data/beos_mime/audio/ogg b/src/data/mime_db/audio/ogg
similarity index 100%
rename from src/data/beos_mime/audio/ogg
rename to src/data/mime_db/audio/ogg
diff --git a/src/data/beos_mime/audio/x-aiff b/src/data/mime_db/audio/x-aiff
similarity index 100%
rename from src/data/beos_mime/audio/x-aiff
rename to src/data/mime_db/audio/x-aiff
diff --git a/src/data/beos_mime/audio/x-ape b/src/data/mime_db/audio/x-ape
similarity index 100%
rename from src/data/beos_mime/audio/x-ape
rename to src/data/mime_db/audio/x-ape
diff --git a/src/data/beos_mime/audio/x-flac b/src/data/mime_db/audio/x-flac
similarity index 100%
rename from src/data/beos_mime/audio/x-flac
rename to src/data/mime_db/audio/x-flac
diff --git a/src/data/beos_mime/audio/x-matroska 
b/src/data/mime_db/audio/x-matroska
similarity index 100%
rename from src/data/beos_mime/audio/x-matroska
rename to src/data/mime_db/audio/x-matroska
diff --git a/src/data/beos_mime/audio/x-mdx b/src/data/mime_db/audio/x-mdx
similarity index 100%
rename from src/data/beos_mime/audio/x-mdx
rename to src/data/mime_db/audio/x-mdx
diff --git a/src/data/beos_mime/audio/x-musepack 
b/src/data/mime_db/audio/x-musepack
similarity index 100%
rename from src/data/beos_mime/audio/x-musepack
rename to src/data/mime_db/audio/x-musepack
diff --git a/src/data/beos_mime/audio/x-wav b/src/data/mime_db/audio/x-wav
similarity index 100%
rename from src/data/beos_mime/audio/x-wav
rename to src/data/mime_db/audio/x-wav
diff --git a/src/data/beos_mime/image.super b/src/data/mime_db/image.super
similarity index 100%
rename from src/data/beos_mime/image.super
rename to src/data/mime_db/image.super
diff --git a/src/data/beos_mime/image/bmp b/src/data/mime_db/image/bmp
similarity index 100%
rename from src/data/beos_mime/image/bmp
rename to src/data/mime_db/image/bmp
diff --git a/src/data/beos_mime/image/gif b/src/data/mime_db/image/gif
similarity index 100%
rename from src/data/beos_mime/image/gif
rename to src/data/mime_db/image/gif
diff --git a/src/data/beos_mime/image/icns b/src/data/mime_db/image/icns
similarity index 100%
rename from src/data/beos_mime/image/icns
rename to src/data/mime_db/image/icns
diff --git a/src/data/beos_mime/image/jp2 b/src/data/mime_db/image/jp2
similarity index 100%
rename from src/data/beos_mime/image/jp2
rename to src/data/mime_db/image/jp2
diff --git a/src/data/beos_mime/image/jpeg b/src/data/mime_db/image/jpeg
similarity index 100%
rename from src/data/beos_mime/image/jpeg
rename to src/data/mime_db/image/jpeg
diff --git a/src/data/beos_mime/image/png b/src/data/mime_db/image/png
similarity index 100%
rename from src/data/beos_mime/image/png
rename to src/data/mime_db/image/png
diff --git a/src/data/beos_mime/image/sgi b/src/data/mime_db/image/sgi
similarity index 100%
rename from src/data/beos_mime/image/sgi
rename to src/data/mime_db/image/sgi
diff --git a/src/data/beos_mime/image/svg+xml b/src/data/mime_db/image/svg+xml
similarity index 100%
rename from src/data/beos_mime/image/svg+xml
rename to src/data/mime_db/image/svg+xml
diff --git a/src/data/beos_mime/image/tiff b/src/data/mime_db/image/tiff
similarity index 100%
rename from src/data/beos_mime/image/tiff
rename to src/data/mime_db/image/tiff
diff --git a/src/data/beos_mime/image/vnd.microsoft.icon 
b/src/data/mime_db/image/vnd.microsoft.icon
similarity index 100%
rename from src/data/beos_mime/image/vnd.microsoft.icon
rename to src/data/mime_db/image/vnd.microsoft.icon
diff --git a/src/data/beos_mime/image/webp b/src/data/mime_db/image/webp
similarity index 100%
rename from src/data/beos_mime/image/webp
rename to src/data/mime_db/image/webp
diff --git a/src/data/beos_mime/image/x-pcx b/src/data/mime_db/image/x-pcx
similarity index 100%
rename from src/data/beos_mime/image/x-pcx
rename to src/data/mime_db/image/x-pcx
diff --git a/src/data/beos_mime/image/x-portable-pixmap 
b/src/data/mime_db/image/x-portable-pixmap
similarity index 100%
rename from src/data/beos_mime/image/x-portable-pixmap
rename to src/data/mime_db/image/x-portable-pixmap
diff --git a/src/data/beos_mime/image/x-targa b/src/data/mime_db/image/x-targa
similarity index 100%
rename from src/data/beos_mime/image/x-targa
rename to src/data/mime_db/image/x-targa
diff --git a/src/data/beos_mime/image/x-wpg b/src/data/mime_db/image/x-wpg
similarity index 100%
rename from src/data/beos_mime/image/x-wpg
rename to src/data/mime_db/image/x-wpg
diff --git a/src/data/beos_mime/message.super b/src/data/mime_db/message.super
similarity index 100%
rename from src/data/beos_mime/message.super
rename to src/data/mime_db/message.super
diff --git a/src/data/beos_mime/message/rfc822 b/src/data/mime_db/message/rfc822
similarity index 100%
rename from src/data/beos_mime/message/rfc822
rename to src/data/mime_db/message/rfc822
diff --git a/src/data/beos_mime/multipart.super 
b/src/data/mime_db/multipart.super
similarity index 100%
rename from src/data/beos_mime/multipart.super
rename to src/data/mime_db/multipart.super
diff --git a/src/data/beos_mime/text.super b/src/data/mime_db/text.super
similarity index 100%
rename from src/data/beos_mime/text.super
rename to src/data/mime_db/text.super
diff --git a/src/data/beos_mime/text/calendar b/src/data/mime_db/text/calendar
similarity index 100%
rename from src/data/beos_mime/text/calendar
rename to src/data/mime_db/text/calendar
diff --git a/src/data/beos_mime/text/css b/src/data/mime_db/text/css
similarity index 100%
rename from src/data/beos_mime/text/css
rename to src/data/mime_db/text/css
diff --git a/src/data/beos_mime/text/csv b/src/data/mime_db/text/csv
similarity index 100%
rename from src/data/beos_mime/text/csv
rename to src/data/mime_db/text/csv
diff --git a/src/data/beos_mime/text/html b/src/data/mime_db/text/html
similarity index 100%
rename from src/data/beos_mime/text/html
rename to src/data/mime_db/text/html
diff --git a/src/data/beos_mime/text/plain b/src/data/mime_db/text/plain
similarity index 100%
rename from src/data/beos_mime/text/plain
rename to src/data/mime_db/text/plain
diff --git a/src/data/beos_mime/text/rtf b/src/data/mime_db/text/rtf
similarity index 100%
rename from src/data/beos_mime/text/rtf
rename to src/data/mime_db/text/rtf
diff --git a/src/data/beos_mime/text/x-email b/src/data/mime_db/text/x-email
similarity index 100%
rename from src/data/beos_mime/text/x-email
rename to src/data/mime_db/text/x-email
diff --git a/src/data/beos_mime/text/x-partial-email 
b/src/data/mime_db/text/x-partial-email
similarity index 100%
rename from src/data/beos_mime/text/x-partial-email
rename to src/data/mime_db/text/x-partial-email
diff --git a/src/data/beos_mime/text/x-patch b/src/data/mime_db/text/x-patch
similarity index 100%
rename from src/data/beos_mime/text/x-patch
rename to src/data/mime_db/text/x-patch
diff --git a/src/data/beos_mime/text/x-source-code 
b/src/data/mime_db/text/x-source-code
similarity index 100%
rename from src/data/beos_mime/text/x-source-code
rename to src/data/mime_db/text/x-source-code
diff --git a/src/data/beos_mime/text/x-url b/src/data/mime_db/text/x-url
similarity index 100%
rename from src/data/beos_mime/text/x-url
rename to src/data/mime_db/text/x-url
diff --git a/src/data/beos_mime/text/x-vcard b/src/data/mime_db/text/x-vcard
similarity index 100%
rename from src/data/beos_mime/text/x-vcard
rename to src/data/mime_db/text/x-vcard
diff --git a/src/data/beos_mime/text/x-vnd.be.resourcedef 
b/src/data/mime_db/text/x-vnd.be.resourcedef
similarity index 100%
rename from src/data/beos_mime/text/x-vnd.be.resourcedef
rename to src/data/mime_db/text/x-vnd.be.resourcedef
diff --git a/src/data/beos_mime/text/xml b/src/data/mime_db/text/xml
similarity index 100%
rename from src/data/beos_mime/text/xml
rename to src/data/mime_db/text/xml
diff --git a/src/data/beos_mime/video.super b/src/data/mime_db/video.super
similarity index 100%
rename from src/data/beos_mime/video.super
rename to src/data/mime_db/video.super
diff --git a/src/data/beos_mime/video/3gpp b/src/data/mime_db/video/3gpp
similarity index 100%
rename from src/data/beos_mime/video/3gpp
rename to src/data/mime_db/video/3gpp
diff --git a/src/data/beos_mime/video/3gpp2 b/src/data/mime_db/video/3gpp2
similarity index 100%
rename from src/data/beos_mime/video/3gpp2
rename to src/data/mime_db/video/3gpp2
diff --git a/src/data/beos_mime/video/dv b/src/data/mime_db/video/dv
similarity index 100%
rename from src/data/beos_mime/video/dv
rename to src/data/mime_db/video/dv
diff --git a/src/data/beos_mime/video/mp2t b/src/data/mime_db/video/mp2t
similarity index 100%
rename from src/data/beos_mime/video/mp2t
rename to src/data/mime_db/video/mp2t
diff --git a/src/data/beos_mime/video/mp4 b/src/data/mime_db/video/mp4
similarity index 100%
rename from src/data/beos_mime/video/mp4
rename to src/data/mime_db/video/mp4
diff --git a/src/data/beos_mime/video/mpeg b/src/data/mime_db/video/mpeg
similarity index 100%
rename from src/data/beos_mime/video/mpeg
rename to src/data/mime_db/video/mpeg
diff --git a/src/data/beos_mime/video/ogg b/src/data/mime_db/video/ogg
similarity index 100%
rename from src/data/beos_mime/video/ogg
rename to src/data/mime_db/video/ogg
diff --git a/src/data/beos_mime/video/quicktime 
b/src/data/mime_db/video/quicktime
similarity index 100%
rename from src/data/beos_mime/video/quicktime
rename to src/data/mime_db/video/quicktime
diff --git a/src/data/beos_mime/video/x-flv b/src/data/mime_db/video/x-flv
similarity index 100%
rename from src/data/beos_mime/video/x-flv
rename to src/data/mime_db/video/x-flv
diff --git a/src/data/beos_mime/video/x-matroska 
b/src/data/mime_db/video/x-matroska
similarity index 100%
rename from src/data/beos_mime/video/x-matroska
rename to src/data/mime_db/video/x-matroska
diff --git a/src/data/beos_mime/video/x-ms-asf b/src/data/mime_db/video/x-ms-asf
similarity index 100%
rename from src/data/beos_mime/video/x-ms-asf
rename to src/data/mime_db/video/x-ms-asf
diff --git a/src/data/beos_mime/video/x-msvideo 
b/src/data/mime_db/video/x-msvideo
similarity index 100%
rename from src/data/beos_mime/video/x-msvideo
rename to src/data/mime_db/video/x-msvideo
diff --git a/src/data/beos_mime/video/x-rmvb b/src/data/mime_db/video/x-rmvb
similarity index 100%
rename from src/data/beos_mime/video/x-rmvb
rename to src/data/mime_db/video/x-rmvb

############################################################################

Commit:      38e3973ecf429e27da158c823369f47f4addf869
Author:      Ingo Weinhold <ingo_weinhold@xxxxxx>
Date:        Tue May  7 02:12:57 2013 UTC

Add private class BMergedDirectory to storage kit

An arbitrary number of directories can be added, which the implemented
BEntryList interface presents as a single merged entry list. Three
different merge policies are supported which define how entries that
appear in more than one directory are treated.

----------------------------------------------------------------------------

diff --git a/headers/private/storage/MergedDirectory.h 
b/headers/private/storage/MergedDirectory.h
new file mode 100644
index 0000000..cf020ba
--- /dev/null
+++ b/headers/private/storage/MergedDirectory.h
@@ -0,0 +1,72 @@
+/*
+ * Copyright 2013, Haiku, Inc. All Rights Reserved.
+ * Distributed under the terms of the MIT License.
+ *
+ * Authors:
+ *             Ingo Weinhold <ingo_weinhold@xxxxxx>
+ */
+#ifndef _MERGED_DIRECTORY_H
+#define _MERGED_DIRECTORY_H
+
+
+#include <EntryList.h>
+#include <ObjectList.h>
+
+
+class BDirectory;
+
+
+class BMergedDirectory : public BEntryList {
+public:
+                       // policy how to handle equally named entries in 
different
+                       // directories
+                       enum BPolicy {
+                               B_ALLOW_DUPLICATES,
+                               B_ALWAYS_FIRST,
+                               B_COMPARE
+                       };
+
+public:
+                                                               
BMergedDirectory(
+                                                                       BPolicy 
policy = B_ALWAYS_FIRST);
+       virtual                                         ~BMergedDirectory();
+
+                       status_t                        Init();
+
+                       BPolicy                         Policy() const;
+                       void                            SetPolicy(BPolicy 
policy);
+
+                       status_t                        
AddDirectory(BDirectory* directory);
+                       status_t                        AddDirectory(const 
char* path);
+
+       virtual status_t                        GetNextEntry(BEntry* entry,
+                                                                       bool 
traverse = false);
+       virtual status_t                        GetNextRef(entry_ref* ref);
+       virtual int32                           GetNextDirents(struct dirent* 
direntBuffer,
+                                                                       size_t 
bufferSize,
+                                                                       int32 
maxEntries = INT_MAX);
+       virtual status_t                        Rewind();
+       virtual int32                           CountEntries();
+
+protected:
+       virtual bool                            ShallPreferFirstEntry(const 
entry_ref& entry1,
+                                                                       int32 
index1, const entry_ref& entry2,
+                                                                       int32 
index2);
+                                                                       // 
always invoked with index1 < index2
+
+private:
+                       typedef BObjectList<BDirectory> DirectoryList;
+                       struct EntryNameSet;
+
+private:
+                       void                            _FindBestEntry(dirent* 
direntBuffer);
+
+private:
+                       DirectoryList           fDirectories;
+                       BPolicy                         fPolicy;
+                       int32                           fDirectoryIndex;
+                       EntryNameSet*           fVisitedEntries;
+};
+
+
+#endif // _MERGED_DIRECTORY_H
diff --git a/src/kits/storage/Jamfile b/src/kits/storage/Jamfile
index ea34109..41c7f7e 100644
--- a/src/kits/storage/Jamfile
+++ b/src/kits/storage/Jamfile
@@ -22,6 +22,7 @@ MergeObject <libbe>storage_kit.o :
        FileDescriptorIO.cpp
        FileIO.cpp
        FindDirectory.cpp
+       MergedDirectory.cpp
        Mime.cpp
        MimeType.cpp
        Node.cpp
diff --git a/src/kits/storage/MergedDirectory.cpp 
b/src/kits/storage/MergedDirectory.cpp
new file mode 100644
index 0000000..2ec338f
--- /dev/null
+++ b/src/kits/storage/MergedDirectory.cpp
@@ -0,0 +1,237 @@
+/*
+ * Copyright 2013, Haiku, Inc. All Rights Reserved.
+ * Distributed under the terms of the MIT License.
+ *
+ * Authors:
+ *             Ingo Weinhold <ingo_weinhold@xxxxxx>
+ */
+
+
+#include <MergedDirectory.h>
+
+#include <new>
+#include <set>
+#include <string>
+
+#include <Directory.h>
+#include <Entry.h>
+
+#include <AutoDeleter.h>
+
+#include "storage_support.h"
+
+
+struct BMergedDirectory::EntryNameSet : std::set<std::string> {
+};
+
+
+BMergedDirectory::BMergedDirectory(BPolicy policy)
+       :
+       BEntryList(),
+       fDirectories(10, true),
+       fPolicy(policy),
+       fDirectoryIndex(0),
+       fVisitedEntries(NULL)
+{
+}
+
+
+BMergedDirectory::~BMergedDirectory()
+{
+       delete fVisitedEntries;
+}
+
+
+status_t
+BMergedDirectory::Init()
+{
+       delete fVisitedEntries;
+       fDirectories.MakeEmpty(true);
+
+       fVisitedEntries = new(std::nothrow) EntryNameSet;
+       return fVisitedEntries != NULL ? B_OK : B_NO_MEMORY;
+}
+
+
+BMergedDirectory::BPolicy
+BMergedDirectory::Policy() const
+{
+       return fPolicy;
+}
+
+
+void
+BMergedDirectory::SetPolicy(BPolicy policy)
+{
+       fPolicy = policy;
+}
+
+
+status_t
+BMergedDirectory::AddDirectory(BDirectory* directory)
+{
+       return fDirectories.AddItem(directory) ? B_OK : B_NO_MEMORY;
+}
+
+
+status_t
+BMergedDirectory::AddDirectory(const char* path)
+{
+       BDirectory* directory = new(std::nothrow) BDirectory(path);
+       if (directory == NULL)
+               return B_NO_MEMORY;
+       ObjectDeleter<BDirectory> directoryDeleter(directory);
+
+       if (directory->InitCheck() != B_OK)
+               return directory->InitCheck();
+
+       status_t error = AddDirectory(directory);
+       if (error != B_OK)
+               return error;
+       directoryDeleter.Detach();
+
+       return B_OK;
+}
+
+
+status_t
+BMergedDirectory::GetNextEntry(BEntry* entry, bool traverse)
+{
+       entry_ref ref;
+       status_t error = GetNextRef(&ref);
+       if (error != B_OK)
+               return error;
+
+       return entry->SetTo(&ref, traverse);
+}
+
+
+status_t
+BMergedDirectory::GetNextRef(entry_ref* ref)
+{
+       BPrivate::Storage::LongDirEntry entry;
+       int32 result = GetNextDirents(&entry, sizeof(entry), 1);
+       if (result < 0)
+               return result;
+       if (result == 0)
+               return B_ENTRY_NOT_FOUND;
+
+       ref->device = entry.d_pdev;
+       ref->directory = entry.d_pino;
+       return ref->set_name(entry.d_name);
+}
+
+
+int32
+BMergedDirectory::GetNextDirents(struct dirent* direntBuffer, size_t 
bufferSize,
+       int32 maxEntries)
+{
+       if (maxEntries <= 0)
+               return B_BAD_VALUE;
+
+       while (fDirectoryIndex < fDirectories.CountItems()) {
+               int32 count = 
fDirectories.ItemAt(fDirectoryIndex)->GetNextDirents(
+                       direntBuffer, bufferSize, 1);
+               if (count < 0)
+                       return count;
+               if (count == 0) {
+                       fDirectoryIndex++;
+                       continue;
+               }
+
+               if (strcmp(direntBuffer->d_name, ".") == 0
+                       || strcmp(direntBuffer->d_name, "..") == 0) {
+                       continue;
+               }
+
+               switch (fPolicy) {
+                       case B_ALLOW_DUPLICATES:
+                               return count;
+
+                       case B_ALWAYS_FIRST:
+                       case B_COMPARE:
+                               if (fVisitedEntries != NULL
+                                       && 
fVisitedEntries->find(direntBuffer->d_name)
+                                               != fVisitedEntries->end()) {
+                                       continue;
+                               }
+
+                               if (fVisitedEntries != NULL) {
+                                       try {
+                                               
fVisitedEntries->insert(direntBuffer->d_name);
+                                       } catch (std::bad_alloc&) {
+                                               return B_NO_MEMORY;
+                                       }
+                               }
+
+                               if (fPolicy == B_COMPARE)
+                                       _FindBestEntry(direntBuffer);
+                               return 1;
+               }
+       }
+
+       return B_ENTRY_NOT_FOUND;
+}
+
+
+status_t
+BMergedDirectory::Rewind()
+{
+       for (int32 i = 0; BDirectory* directory = fDirectories.ItemAt(i); i++)
+               directory->Rewind();
+
+       if (fVisitedEntries != NULL)
+               fVisitedEntries->clear();
+
+       fDirectoryIndex = 0;
+       return B_OK;
+}
+
+
+int32
+BMergedDirectory::CountEntries()
+{
+       int32 count = 0;
+       char buffer[sizeof(dirent) + B_FILE_NAME_LENGTH];
+       while (GetNextDirents((dirent*)&buffer, sizeof(buffer), 1) == 1)
+               count++;
+       return count;
+}
+
+
+bool
+BMergedDirectory::ShallPreferFirstEntry(const entry_ref& entry1, int32 index1,
+       const entry_ref& entry2, int32 index2)
+{
+       // That's basically B_ALWAYS_FIRST semantics. A derived class will 
implement
+       // the desired semantics.
+       return true;
+}
+
+
+void
+BMergedDirectory::_FindBestEntry(dirent* direntBuffer)
+{
+       entry_ref bestEntry(direntBuffer->d_pdev, direntBuffer->d_pino,
+               direntBuffer->d_name);
+       if (bestEntry.name == NULL)
+               return;
+       int32 bestIndex = fDirectoryIndex;
+
+       int32 directoryCount = fDirectories.CountItems();
+       for (int32 i = fDirectoryIndex + 1; i < directoryCount; i++) {
+               BEntry entry(fDirectories.ItemAt(i), bestEntry.name);
+               struct stat st;
+               entry_ref ref;
+               if (entry.GetStat(&st) == B_OK && entry.GetRef(&ref) == B_OK
+                       && !ShallPreferFirstEntry(bestEntry, bestIndex, ref, 
i)) {
+                       direntBuffer->d_pdev = ref.device;
+                       direntBuffer->d_pino = ref.directory;
+                       direntBuffer->d_dev = st.st_dev;
+                       direntBuffer->d_ino = st.st_ino;
+                       bestEntry.device = ref.device;
+                       bestEntry.directory = ref.directory;
+                       bestIndex = i;
+               }
+       }
+}

############################################################################

Commit:      59a653b51cdae6a8f87db8cb68c86998b48bfc62
Author:      Ingo Weinhold <ingo_weinhold@xxxxxx>
Date:        Tue May  7 02:43:15 2013 UTC

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.

----------------------------------------------------------------------------

diff --git a/headers/private/storage/mime/database_support.h 
b/headers/private/storage/mime/database_support.h
index d6a1e8a..0e549032 100644
--- a/headers/private/storage/mime/database_support.h
+++ b/headers/private/storage/mime/database_support.h
@@ -7,12 +7,12 @@
 
 
 #include <StorageDefs.h>
+#include <String.h>
 
-#include <string>
 
 class BNode;
 class BMessage;
-class BString;
+class BStringList;
 
 
 namespace BPrivate {
@@ -20,8 +20,8 @@ namespace Storage {
 namespace Mime {
 
 // Database directory
-const std::string get_database_directory();
-const std::string get_application_database_directory();
+const BStringList& get_database_directories();
+BString get_writable_database_directory();
 
 // Attribute Prefixes
 extern const char *kMiniIconAttrPrefix;
@@ -75,7 +75,7 @@ extern const char *kMetaMimeType;
 // Error codes (to be used only by BPrivate::Storage::Mime members)
 extern const status_t kMimeGuessFailureError;
 
-std::string type_to_filename(const char *type);
+BString type_to_writable_filename(const char *type);
 
 status_t open_type(const char *type, BNode *result);
 status_t open_or_create_type(const char *type, BNode *result, bool *didCreate);
diff --git a/src/kits/storage/mime/database_support.cpp 
b/src/kits/storage/mime/database_support.cpp
index 750a5c0..09703f4 100644
--- a/src/kits/storage/mime/database_support.cpp
+++ b/src/kits/storage/mime/database_support.cpp
@@ -4,6 +4,7 @@
  *
  * Authors:
  *             Tyler Dauwalder
+ *             Ingo Weinhold <ingo_weinhold@xxxxxx>
  */
 
 /*!
@@ -14,18 +15,23 @@
 #include <AppMisc.h>
 #include <DataIO.h>
 #include <Directory.h>
-#include <Entry.h>
+#include <File.h>
 #include <FindDirectory.h>
+#include <Entry.h>
 #include <Message.h>
 #include <Node.h>
 #include <Path.h>
 #include <storage_support.h>
+#include <StringList.h>
 #include <TypeConstants.h>
 
 #include <fs_attr.h>   // For struct attr_info
 #include <new>                 // For new(nothrow)
 #include <stdio.h>
 #include <string.h>
+#include <syslog.h>
+
+#include <AutoDeleter.h>
 
 #include "mime/database_support.h"
 
@@ -94,49 +100,187 @@ const char *kMetaMimeType         = 
"application/x-vnd.Be-meta-mime";
 // Error codes
 const status_t kMimeGuessFailureError  = B_ERRORS_END+1;
 
+static const directory_which kBaseDirectoryConstants[] = {
+       B_USER_SETTINGS_DIRECTORY,
+       B_USER_NONPACKAGED_DATA_DIRECTORY,
+       B_USER_DATA_DIRECTORY,
+       B_COMMON_NONPACKAGED_DATA_DIRECTORY,
+       B_COMMON_DATA_DIRECTORY,
+       B_SYSTEM_DATA_DIRECTORY
+};
+
 static pthread_once_t sDatabaseDirectoryInitOnce = PTHREAD_ONCE_INIT;
-static std::string sDatabaseDirectory;
-static std::string sApplicationDatabaseDirectory;
+static BStringList sDatabaseDirectories;
 
 
 static void
 init_database_directories()
 {
-       BPath path;
-       if (find_directory(B_USER_SETTINGS_DIRECTORY, &path) == B_OK)
-               sDatabaseDirectory = path.Path();
-       else
-               sDatabaseDirectory = "/boot/home/config/settings";
+       for (size_t i = 0;
+               i < sizeof(kBaseDirectoryConstants)
+                       / sizeof(kBaseDirectoryConstants[0]); i++) {
+               BString directoryPath;
+               BPath path;
+               if (find_directory(kBaseDirectoryConstants[i], &path) == B_OK)
+                       directoryPath = path.Path();
+               else if (i == 0)
+                       directoryPath = "/boot/home/config/settings";
+               else
+                       continue;
 
-       sDatabaseDirectory += "/beos_mime";
-       sApplicationDatabaseDirectory = sDatabaseDirectory + "/application";
+               directoryPath += "/mime_db";
+               sDatabaseDirectories.Add(directoryPath);
+       }
 }
 
 
-const std::string
-get_database_directory()
+const BStringList&
+get_database_directories()
 {
        pthread_once(&sDatabaseDirectoryInitOnce, &init_database_directories);
-       return sDatabaseDirectory;
+       return sDatabaseDirectories;
 }
 
 
-const std::string
-get_application_database_directory()
+BString
+get_writable_database_directory()
 {
-       pthread_once(&sDatabaseDirectoryInitOnce, &init_database_directories);
-       return sApplicationDatabaseDirectory;
+       return get_database_directories().StringAt(0);
+}
+
+
+static BString
+type_to_filename(const char* type, int32 index)
+{
+       BString path = get_database_directories().StringAt(index);
+       return path << '/' << BPrivate::Storage::to_lower(type).c_str();
+}
+
+
+/*! Converts the given MIME type to an absolute path in the user writeable MIME
+       database directory.
+*/
+BString
+type_to_writable_filename(const char* type)
+{
+       return type_to_filename(type, 0);
 }
 
 
-// type_to_filename
-//! Converts the given MIME type to an absolute path in the MIME database.
-std::string
-type_to_filename(const char *type)
+static status_t
+open_type(const char* type, BNode* _node, int32& _index)
 {
-       return get_database_directory() + "/" + 
BPrivate::Storage::to_lower(type);
+       const BStringList& directories = get_database_directories();
+       int32 count = directories.CountStrings();
+       for (int32 i = 0; i < count; i++) {
+               status_t error = _node->SetTo(type_to_filename(type, i));
+               attr_info attrInfo;
+               if (error == B_OK && _node->GetAttrInfo(kTypeAttr, &attrInfo) 
== B_OK) {
+                       _index = i;
+                       return B_OK;
+               }
+       }
+
+       return B_ENTRY_NOT_FOUND;
 }
 
+
+static status_t
+create_type_node(const char* type, BNode& _result)
+{
+       const char* slash = strchr(type, '/');
+       BString superTypeName;
+       if (slash != NULL)
+               superTypeName.SetTo(type, slash - type);
+       else
+               superTypeName = type;
+       superTypeName.ToLower();
+
+       // open/create the directory for the supertype
+       BDirectory parent(get_writable_database_directory());
+       status_t error = parent.InitCheck();
+       if (error != B_OK)
+               return error;
+
+       BDirectory superTypeDirectory;
+       if (BEntry(&parent, superTypeName).Exists())
+               error = superTypeDirectory.SetTo(&parent, superTypeName);
+       else
+               error = parent.CreateDirectory(superTypeName, 
&superTypeDirectory);
+       if (error != B_OK)
+               return error;
+
+       // create the subtype
+       BFile subTypeFile;
+       if (slash != NULL) {
+               error = superTypeDirectory.CreateFile(BString(slash + 
1).ToLower(),
+                       &subTypeFile);
+               if (error != B_OK)
+                       return error;
+       }
+
+       // assign the result
+       if (slash != NULL)
+               _result = subTypeFile;
+       else
+               _result = superTypeDirectory;
+       return _result.InitCheck();
+}
+
+
+static status_t
+copy_type_node(BNode& source, const char* type, BNode& _target)
+{
+       status_t error = create_type_node(type, _target);
+       if (error != B_OK)
+               return error;
+
+       // copy the attributes
+       MemoryDeleter bufferDeleter;
+       size_t bufferSize = 0;
+
+       source.RewindAttrs();
+       char attribute[B_ATTR_NAME_LENGTH];
+       while (source.GetNextAttrName(attribute) == B_OK) {
+               attr_info info;
+               error = source.GetAttrInfo(attribute, &info);
+               if (error != B_OK) {
+                       syslog(LOG_ERR, "Failed to get info for attribute 
\"%s\" of MIME "
+                               "type \"%s\": %s", attribute, type, 
strerror(error));
+                       continue;
+               }
+
+               // resize our buffer, if necessary
+               if (info.size > bufferSize) {
+                       bufferDeleter.SetTo(malloc(info.size));
+                       if (bufferDeleter.Get() == NULL)
+                               return B_NO_MEMORY;
+                       bufferSize = info.size;
+               }
+
+               ssize_t bytesRead = source.ReadAttr(attribute, info.type, 0,
+                       bufferDeleter.Get(), info.size);
+               if (bytesRead != info.size) {
+                       syslog(LOG_ERR, "Failed to read attribute \"%s\" of 
MIME "
+                               "type \"%s\": %s", attribute, type,
+                               bytesRead < 0 ? strerror(bytesRead) : "short 
read");
+                       continue;
+               }
+
+               ssize_t bytesWritten = _target.WriteAttr(attribute, info.type, 
0,
+                       bufferDeleter.Get(), info.size);
+               if (bytesWritten < 0) {
+                       syslog(LOG_ERR, "Failed to write attribute \"%s\" of 
MIME "
+                               "type \"%s\": %s", attribute, type,
+                               bytesWritten < 0 ? strerror(bytesWritten) : 
"short write");
+                       continue;
+               }
+       }
+
+       return B_OK;
+}
+
+
 // open_type
 /*! \brief Opens a BNode on the given type, failing if the type has no
            corresponding file in the database.
@@ -150,20 +294,8 @@ open_type(const char *type, BNode *result)
        if (type == NULL || result == NULL)
                return B_BAD_VALUE;
 
-       status_t status = result->SetTo(type_to_filename(type).c_str());
-
-       // TODO: this can be removed again later - we just didn't write this
-       //      attribute is before     at all...
-#if 1
-       if (status == B_OK) {
-               // check if the MIME:TYPE attribute exist, and create it if not
-               attr_info info;
-               if (result->GetAttrInfo(kTypeAttr, &info) != B_OK)
-                       result->WriteAttr(kTypeAttr, B_STRING_TYPE, 0, type, 
strlen(type) + 1);
-       }
-#endif
-
-       return status;
+       int32 index;
+       return open_type(type, result, index);
 }
 
 // open_or_create_type
@@ -180,44 +312,47 @@ open_or_create_type(const char *type, BNode *result, bool 
*didCreate)
 {
        if (didCreate)
                *didCreate = false;
-       std::string filename;
-       std::string typeLower = BPrivate::Storage::to_lower(type);
-       status_t err = (type && result ? B_OK : B_BAD_VALUE);
-       if (!err) {
-               filename = type_to_filename(type);
-               err = result->SetTo(filename.c_str());
-       }
-       if (err == B_ENTRY_NOT_FOUND) {
-               // Figure out what type of node we need to create
-               // + Supertype == directory
-               // + Non-supertype == file
-               size_t pos = typeLower.find_first_of('/');
-               if (pos == std::string::npos) {
-                       // Supertype == directory
-                       BDirectory parent(get_database_directory().c_str());
-                       err = parent.InitCheck();
-                       if (!err)
-                               err = parent.CreateDirectory(typeLower.c_str(), 
NULL);
-               } else {
-                       // Non-supertype == file
-                       std::string super(typeLower, 0, pos);
-                       std::string sub(typeLower, pos+1);
-                       BDirectory parent((get_database_directory() + "/" + 
super).c_str());
-                       err = parent.InitCheck();
-                       if (!err)
-                               err = parent.CreateFile(sub.c_str(), NULL);
+
+       // See, if the type already exists.
+       int32 index;
+       status_t error = open_type(type, result, index);
+       if (error == B_OK) {
+               if (index == 0)
+                       return B_OK;
+
+               // The caller wants a editable node, but the node found is not 
in the
+               // user's settings directory. Copy the node.
+               BNode nodeToClone(*result);
+               if (nodeToClone.InitCheck() != B_OK)
+                       return nodeToClone.InitCheck();
+
+               error = copy_type_node(nodeToClone, type, *result);
+               if (error != B_OK) {
+                       result->Unset();
+                       return error;
                }
-               // Now try opening again
-               if (err == B_OK)
-                       err = result->SetTo(filename.c_str());
-               if (err == B_OK && didCreate)
+
+               if (didCreate != NULL)
                        *didCreate = true;
-               if (err == B_OK) {
-                       // write META:TYPE attribute
-                       result->WriteAttr(kTypeAttr, B_STRING_TYPE, 0, type, 
strlen(type) + 1);
-               }
+               return error;
        }
-       return err;
+
+       // type doesn't exist yet -- create the respective node
+       error = create_type_node(type, *result);
+       if (error != B_OK)
+               return error;
+
+       // write the type attribute
+       error = result->WriteAttr(kTypeAttr, B_STRING_TYPE, 0, type,
+               strlen(type) + 1);
+       if (error != B_OK) {
+               result->Unset();
+               return error;
+       }
+
+       if (didCreate != NULL)
+               *didCreate = true;
+       return B_OK;
 }
 
 // read_mime_attr
diff --git a/src/servers/registrar/Jamfile b/src/servers/registrar/Jamfile
index a2e77cc..eba9ad5 100644
--- a/src/servers/registrar/Jamfile
+++ b/src/servers/registrar/Jamfile
@@ -43,6 +43,7 @@ Server registrar
        AssociatedTypes.cpp
        CreateAppMetaMimeThread.cpp
        Database.cpp
+       DatabaseDirectory.cpp
        InstalledTypes.cpp
        MimeSnifferAddon.cpp
        MimeSnifferAddonManager.cpp
diff --git a/src/servers/registrar/mime/AssociatedTypes.cpp 
b/src/servers/registrar/mime/AssociatedTypes.cpp
index 8865da9..8550839 100644
--- a/src/servers/registrar/mime/AssociatedTypes.cpp
+++ b/src/servers/registrar/mime/AssociatedTypes.cpp
@@ -8,7 +8,10 @@
 */
 
 #include "AssociatedTypes.h"
-#include "MimeSnifferAddonManager.h"
+
+#include <stdio.h>
+
+#include <new>
 
 #include <Directory.h>
 #include <Entry.h>
@@ -19,8 +22,9 @@
 #include <mime/database_support.h>
 #include <storage_support.h>
 
-#include <new>
-#include <stdio.h>
+#include "DatabaseDirectory.h"
+#include "MimeSnifferAddonManager.h"
+
 
 #define DBG(x) x
 //#define DBG(x)
@@ -330,8 +334,8 @@ AssociatedTypes::BuildAssociatedTypesTable()
        fFileExtensions.clear();
        fAssociatedTypes.clear();
 
-       BDirectory root;
-       status_t err = root.SetTo(get_database_directory().c_str());
+       DatabaseDirectory root;
+       status_t err = root.Init();
        if (!err) {
                root.Rewind();
                while (true) {
@@ -354,8 +358,8 @@ AssociatedTypes::BuildAssociatedTypesTable()
 
                                        // First, iterate through this 
supertype directory and process
                                        // all of its subtypes
-                                       BDirectory dir;
-                                       if (dir.SetTo(&entry) == B_OK) {
+                                       DatabaseDirectory dir;
+                                       if (dir.Init(supertype) == B_OK) {
                                                dir.Rewind();
                                                while (true) {
                                                        BEntry subEntry;
@@ -392,8 +396,7 @@ AssociatedTypes::BuildAssociatedTypesTable()
                }
        } else {
                DBG(OUT("Mime::AssociatedTypes::BuildAssociatedTypesTable(): "
-                         "Failed opening mime database directory '%s'\n",
-                           get_database_directory().c_str()));
+                         "Failed opening mime database directory\n"));
        }
        if (!err) {
                fHaveDoneFullBuild = true;
diff --git a/src/servers/registrar/mime/Database.cpp 
b/src/servers/registrar/mime/Database.cpp
index 13532a6..96fb882 100644
--- a/src/servers/registrar/mime/Database.cpp
+++ b/src/servers/registrar/mime/Database.cpp
@@ -65,9 +65,9 @@ Database::Database()
        fDeferredInstallNotificationsLocker("deferred install notifications"),
        fDeferredInstallNotifications()
 {
-       // Do some really minor error checking
-       BEntry entry(get_database_directory().c_str());
-       fStatus = entry.Exists() ? B_OK : B_BAD_VALUE;
+       // make sure the user's MIME DB directory exists
+       fStatus = create_directory(get_writable_database_directory(),
+               S_IRWXU | S_IRGRP | S_IXGRP | S_IROTH | S_IXOTH);
 }
 
 // destructor
@@ -107,7 +107,7 @@ Database::Install(const char *type)
                return B_BAD_VALUE;
 
        BEntry entry;
-       status_t err = entry.SetTo(type_to_filename(type).c_str());
+       status_t err = entry.SetTo(type_to_writable_filename(type));
        if (!err) {
                if (entry.Exists())
                        err = B_FILE_EXISTS;
@@ -139,7 +139,7 @@ Database::Delete(const char *type)
 
        // Open the type
        BEntry entry;
-       status_t status = entry.SetTo(type_to_filename(type).c_str());
+       status_t status = entry.SetTo(type_to_writable_filename(type));
        if (status != B_OK)
                return status;
 
diff --git a/src/servers/registrar/mime/DatabaseDirectory.cpp 
b/src/servers/registrar/mime/DatabaseDirectory.cpp
new file mode 100644
index 0000000..2c4699d
--- /dev/null
+++ b/src/servers/registrar/mime/DatabaseDirectory.cpp

[ *** diff truncated: 260 lines dropped *** ]



Other related posts: