зеркало из https://github.com/mozilla/gecko-dev.git
Fix BeOS build by making changing nsResProtocolHandler.cpp like
Windows and Mac, and fix a couple nsSpecialSystemDirectory bugs. All the changes are BeOS specific (i.e. wrapped in XP_BEOS or only used by code wrapped in XP_BEOS). r=mcafee
This commit is contained in:
Родитель
a701ce3c25
Коммит
be3945ad99
|
@ -82,6 +82,8 @@ nsResProtocolHandler::Init()
|
||||||
nsSpecialSystemDirectory::Mac_SystemDirectory
|
nsSpecialSystemDirectory::Mac_SystemDirectory
|
||||||
#elif XP_PC
|
#elif XP_PC
|
||||||
nsSpecialSystemDirectory::Win_SystemDirectory
|
nsSpecialSystemDirectory::Win_SystemDirectory
|
||||||
|
#elif XP_BEOS
|
||||||
|
nsSpecialSystemDirectory::BeOS_SystemDirectory
|
||||||
#else
|
#else
|
||||||
nsSpecialSystemDirectory::Unix_LibDirectory // XXX ???
|
nsSpecialSystemDirectory::Unix_LibDirectory // XXX ???
|
||||||
#endif
|
#endif
|
||||||
|
@ -141,35 +143,8 @@ nsResProtocolHandler::Init()
|
||||||
|
|
||||||
#elif defined(XP_BEOS)
|
#elif defined(XP_BEOS)
|
||||||
|
|
||||||
// first add $MOZILLA_FIVE_HOME if it exists
|
rv = SetSpecialDir("Resource", nsSpecialSystemDirectory::XPCOM_CurrentProcessComponentRegistry);
|
||||||
const char *moz5 = getenv("MOZILLA_FIVE_HOME");
|
|
||||||
if (moz5) {
|
|
||||||
char* fileURL = PR_smprintf("file:///%s", moz5);
|
|
||||||
rv = AppendSubstitution("Resource", fileURL);
|
|
||||||
PR_Free(fileURL);
|
|
||||||
if (NS_FAILED(rv)) return rv;
|
|
||||||
}
|
|
||||||
|
|
||||||
// then add pwd
|
|
||||||
static char buf[MAXPATHLEN];
|
|
||||||
int32 cookie = 0;
|
|
||||||
image_info info;
|
|
||||||
char *p;
|
|
||||||
*buf = 0;
|
|
||||||
if (get_next_image_info(0, &cookie, &info) != B_OK) {
|
|
||||||
NS_WARNING("res protocol: get_next_image_info failed");
|
|
||||||
return NS_ERROR_FAILURE;
|
|
||||||
}
|
|
||||||
strcpy(buf, info.name);
|
|
||||||
if ((p = strrchr(buf, '/')) == 0) {
|
|
||||||
NS_WARNING("res protocol: no slash in working dir");
|
|
||||||
return NS_ERROR_FAILURE;
|
|
||||||
}
|
|
||||||
*p = 0;
|
|
||||||
char* fileURL = PR_smprintf("file:///%s", buf);
|
|
||||||
rv = AppendSubstitution("Resource", fileURL);
|
|
||||||
if (NS_FAILED(rv)) return rv;
|
if (NS_FAILED(rv)) return rv;
|
||||||
PR_Free(fileURL);
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -691,31 +691,58 @@ void nsSpecialSystemDirectory::operator = (SystemDirectories aSystemSystemDirect
|
||||||
#ifdef XP_BEOS
|
#ifdef XP_BEOS
|
||||||
case BeOS_SettingsDirectory:
|
case BeOS_SettingsDirectory:
|
||||||
{
|
{
|
||||||
BPath p;
|
char path[MAXPATHLEN];
|
||||||
if(find_directory(B_USER_SETTINGS_DIRECTORY, &p) == B_OK)
|
find_directory(B_USER_SETTINGS_DIRECTORY, 0, 0, path, MAXPATHLEN);
|
||||||
*this = p.Path();
|
// Need enough space to add the trailing backslash
|
||||||
else
|
int len = strlen(path);
|
||||||
*this = "/boot/home/config/settings";
|
if (len > MAXPATHLEN-2)
|
||||||
|
break;
|
||||||
|
path[len] = '/';
|
||||||
|
path[len+1] = '\0';
|
||||||
|
*this = path;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case BeOS_HomeDirectory:
|
case BeOS_HomeDirectory:
|
||||||
{
|
{
|
||||||
BPath p;
|
char path[MAXPATHLEN];
|
||||||
if(find_directory(B_USER_DIRECTORY, &p) == B_OK)
|
find_directory(B_USER_DIRECTORY, 0, 0, path, MAXPATHLEN);
|
||||||
*this = p.Path();
|
// Need enough space to add the trailing backslash
|
||||||
else
|
int len = strlen(path);
|
||||||
*this = "/boot/home";
|
if (len > MAXPATHLEN-2)
|
||||||
|
break;
|
||||||
|
path[len] = '/';
|
||||||
|
path[len+1] = '\0';
|
||||||
|
*this = path;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case BeOS_DesktopDirectory:
|
case BeOS_DesktopDirectory:
|
||||||
{
|
{
|
||||||
BPath p;
|
char path[MAXPATHLEN];
|
||||||
if(find_directory(B_DESKTOP_DIRECTORY, &p) == B_OK)
|
find_directory(B_DESKTOP_DIRECTORY, 0, 0, path, MAXPATHLEN);
|
||||||
*this = p.Path();
|
// Need enough space to add the trailing backslash
|
||||||
else
|
int len = strlen(path);
|
||||||
*this = "/boot/home/Desktop";
|
if (len > MAXPATHLEN-2)
|
||||||
|
break;
|
||||||
|
path[len] = '/';
|
||||||
|
path[len+1] = '\0';
|
||||||
|
*this = path;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
case BeOS_SystemDirectory:
|
||||||
|
{
|
||||||
|
char path[MAXPATHLEN];
|
||||||
|
find_directory(B_BEOS_DIRECTORY, 0, 0, path, MAXPATHLEN);
|
||||||
|
// Need enough space to add the trailing backslash
|
||||||
|
int len = strlen(path);
|
||||||
|
if (len > MAXPATHLEN-2)
|
||||||
|
break;
|
||||||
|
path[len] = '/';
|
||||||
|
path[len+1] = '\0';
|
||||||
|
*this = path;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -99,6 +99,7 @@ class NS_COM nsSpecialSystemDirectory : public nsFileSpec
|
||||||
, BeOS_SettingsDirectory = 401
|
, BeOS_SettingsDirectory = 401
|
||||||
, BeOS_HomeDirectory = 402
|
, BeOS_HomeDirectory = 402
|
||||||
, BeOS_DesktopDirectory = 403
|
, BeOS_DesktopDirectory = 403
|
||||||
|
, BeOS_SystemDirectory = 404
|
||||||
};
|
};
|
||||||
|
|
||||||
//nsSpecialSystemDirectory();
|
//nsSpecialSystemDirectory();
|
||||||
|
|
Загрузка…
Ссылка в новой задаче