Haiku: Remove use of B_COMMON_DIRECTORY

The common directory was removed in Haiku. Applications are now
installed in the system directory.

Applied-by: Rolf Eike Beer <eike@sf-mail.de>
This commit is contained in:
Adrien Destugues 2013-10-05 16:31:36 +02:00 committed by Brad King
parent 7ebc1cb2ff
commit 1dc61f8142
4 changed files with 31 additions and 22 deletions

View File

@ -26,7 +26,8 @@
#include <algorithm> #include <algorithm>
#if defined(__HAIKU__) #if defined(__HAIKU__)
#include <StorageKit.h> #include <FindDirectory.h>
#include <StorageDefs.h>
#endif #endif
//---------------------------------------------------------------------- //----------------------------------------------------------------------
@ -1263,14 +1264,14 @@ const char* cmCPackGenerator::GetInstallPath()
this->InstallPath += "-"; this->InstallPath += "-";
this->InstallPath += this->GetOption("CPACK_PACKAGE_VERSION"); this->InstallPath += this->GetOption("CPACK_PACKAGE_VERSION");
#elif defined(__HAIKU__) #elif defined(__HAIKU__)
BPath dir; char dir[B_PATH_NAME_LENGTH];
if (find_directory(B_COMMON_DIRECTORY, &dir) == B_OK) if (find_directory(B_SYSTEM_DIRECTORY, -1, false, dir, sizeof(dir)) == B_OK)
{ {
this->InstallPath = dir.Path(); this->InstallPath = dir;
} }
else else
{ {
this->InstallPath = "/boot/common"; this->InstallPath = "/boot/system";
} }
#else #else
this->InstallPath = "/usr/local/"; this->InstallPath = "/usr/local/";

View File

@ -20,7 +20,8 @@
#include "cmExportBuildFileGenerator.h" #include "cmExportBuildFileGenerator.h"
#if defined(__HAIKU__) #if defined(__HAIKU__)
#include <StorageKit.h> #include <FindDirectory.h>
#include <StorageDefs.h>
#endif #endif
cmExportCommand::cmExportCommand() cmExportCommand::cmExportCommand()
@ -316,14 +317,15 @@ void cmExportCommand::StorePackageRegistryDir(std::string const& package,
const char* hash) const char* hash)
{ {
#if defined(__HAIKU__) #if defined(__HAIKU__)
BPath dir; char dir[B_PATH_NAME_LENGTH];
if (find_directory(B_USER_SETTINGS_DIRECTORY, &dir) != B_OK) if (find_directory(B_USER_SETTINGS_DIRECTORY, -1, false, dir, sizeof(dir)) !=
B_OK)
{ {
return; return;
} }
dir.Append("cmake/packages"); std::string fname = dir;
dir.Append(package.c_str()); fname += "/cmake/packages/";
std::string fname = dir.Path(); fname += package;
#else #else
const char* home = cmSystemTools::GetEnv("HOME"); const char* home = cmSystemTools::GetEnv("HOME");
if(!home) if(!home)

View File

@ -19,7 +19,9 @@
#endif #endif
#if defined(__HAIKU__) #if defined(__HAIKU__)
#include <StorageKit.h> #include <string.h>
#include <FindDirectory.h>
#include <StorageDefs.h>
#endif #endif
void cmFindPackageNeedBackwardsCompatibility(const std::string& variable, void cmFindPackageNeedBackwardsCompatibility(const std::string& variable,
@ -1584,12 +1586,14 @@ void cmFindPackageCommand::AddPrefixesUserRegistry()
#if defined(_WIN32) && !defined(__CYGWIN__) #if defined(_WIN32) && !defined(__CYGWIN__)
this->LoadPackageRegistryWinUser(); this->LoadPackageRegistryWinUser();
#elif defined(__HAIKU__) #elif defined(__HAIKU__)
BPath dir; char dir[B_PATH_NAME_LENGTH];
if (find_directory(B_USER_SETTINGS_DIRECTORY, &dir) == B_OK) if (find_directory(B_USER_SETTINGS_DIRECTORY, -1, false, dir, sizeof(dir)) ==
B_OK)
{ {
dir.Append("cmake/packages"); std::string fname = dir;
dir.Append(this->Name.c_str()); fname += "/cmake/packages/";
this->LoadPackageRegistryDir(dir.Path()); fname += Name;
this->LoadPackageRegistryDir(fname);
} }
#else #else
if(const char* home = cmSystemTools::GetEnv("HOME")) if(const char* home = cmSystemTools::GetEnv("HOME"))

View File

@ -37,7 +37,8 @@
#include <assert.h> #include <assert.h>
#if defined(__HAIKU__) #if defined(__HAIKU__)
#include <StorageKit.h> #include <FindDirectory.h>
#include <StorageDefs.h>
#endif #endif
cmLocalGenerator::cmLocalGenerator() cmLocalGenerator::cmLocalGenerator()
@ -349,16 +350,17 @@ void cmLocalGenerator::GenerateInstallRules()
prefix = prefix_win32.c_str(); prefix = prefix_win32.c_str();
} }
#elif defined(__HAIKU__) #elif defined(__HAIKU__)
char dir[B_PATH_NAME_LENGTH];
if (!prefix) if (!prefix)
{ {
BPath dir; if (find_directory(B_SYSTEM_DIRECTORY, -1, false, dir, sizeof(dir))
if (find_directory(B_COMMON_DIRECTORY, &dir) == B_OK) == B_OK)
{ {
prefix = dir.Path(); prefix = dir;
} }
else else
{ {
prefix = "/boot/common"; prefix = "/boot/system";
} }
} }
#else #else