Obtain user settings dir path via find_directory() now.

git-svn-id: file:///srv/svn/repos/haiku/trunk/current@10814 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Ingo Weinhold 2005-01-18 01:13:13 +00:00
parent 289adc045d
commit 45c3a5cfa9

View File

@ -11,6 +11,7 @@
#include <DataIO.h>
#include <Directory.h>
#include <Entry.h>
#include <FindDirectory.h>
#include <Message.h>
#include <Node.h>
#include <Path.h>
@ -38,12 +39,17 @@ namespace BPrivate {
namespace Storage {
namespace Mime {
static const char *sHaikuDBDir = "/boot/home/config/settings/beos_mime";
static const char *get_user_settings_dir(BPath &path);
static BPath sSettingsDirPath;
static const std::string sSettingsDir = get_user_settings_dir(sSettingsDirPath);
static const char *sHaikuDBDirName = "beos_mime";
// when running natively under Haiku
static const char *sBeOSDBDir = "/boot/home/config/settings/obos_mime";
static const char *sBeOSDBDirName = "obos_mime";
// when running under BeOS
const std::string kDatabaseDir
= (is_running_on_haiku() ? sHaikuDBDir : sBeOSDBDir);
const std::string kDatabaseDir = sSettingsDir + "/"
+ (is_running_on_haiku() ? sHaikuDBDirName : sBeOSDBDirName);
const std::string kApplicationDatabaseDir = kDatabaseDir + "/application";
#define ATTR_PREFIX "META:"
@ -98,6 +104,21 @@ const char *kMetaMimeType = "application/x-vnd.Be-meta-mime";
// Error codes
const status_t kMimeGuessFailureError = B_ERRORS_END+1;
// get_settings_dir
/*! \brief Sets the supplied BPath to the user settings directory and returns
it as C string.
\param path BPath to be set to the user settings path.
\return the user settings path as C string (\code path.Path() \endcode).
*/
static
const char*
get_user_settings_dir(BPath &path)
{
if (find_directory(B_USER_SETTINGS_DIRECTORY, &path) != B_OK)
path.SetTo("/boot/home/config/settings");
return path.Path();
}
// type_to_filename
//! Converts the given MIME type to an absolute path in the MIME database.
std::string