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:
duncan%be.com 2000-01-08 09:09:02 +00:00
Родитель a701ce3c25
Коммит be3945ad99
3 изменённых файлов: 46 добавлений и 43 удалений

Просмотреть файл

@ -82,6 +82,8 @@ nsResProtocolHandler::Init()
nsSpecialSystemDirectory::Mac_SystemDirectory
#elif XP_PC
nsSpecialSystemDirectory::Win_SystemDirectory
#elif XP_BEOS
nsSpecialSystemDirectory::BeOS_SystemDirectory
#else
nsSpecialSystemDirectory::Unix_LibDirectory // XXX ???
#endif
@ -141,35 +143,8 @@ nsResProtocolHandler::Init()
#elif defined(XP_BEOS)
// first add $MOZILLA_FIVE_HOME if it exists
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);
rv = SetSpecialDir("Resource", nsSpecialSystemDirectory::XPCOM_CurrentProcessComponentRegistry);
if (NS_FAILED(rv)) return rv;
PR_Free(fileURL);
#endif

Просмотреть файл

@ -691,31 +691,58 @@ void nsSpecialSystemDirectory::operator = (SystemDirectories aSystemSystemDirect
#ifdef XP_BEOS
case BeOS_SettingsDirectory:
{
BPath p;
if(find_directory(B_USER_SETTINGS_DIRECTORY, &p) == B_OK)
*this = p.Path();
else
*this = "/boot/home/config/settings";
char path[MAXPATHLEN];
find_directory(B_USER_SETTINGS_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;
}
case BeOS_HomeDirectory:
{
BPath p;
if(find_directory(B_USER_DIRECTORY, &p) == B_OK)
*this = p.Path();
else
*this = "/boot/home";
char path[MAXPATHLEN];
find_directory(B_USER_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;
}
case BeOS_DesktopDirectory:
{
BPath p;
if(find_directory(B_DESKTOP_DIRECTORY, &p) == B_OK)
*this = p.Path();
else
*this = "/boot/home/Desktop";
char path[MAXPATHLEN];
find_directory(B_DESKTOP_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;
}
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

Просмотреть файл

@ -99,6 +99,7 @@ class NS_COM nsSpecialSystemDirectory : public nsFileSpec
, BeOS_SettingsDirectory = 401
, BeOS_HomeDirectory = 402
, BeOS_DesktopDirectory = 403
, BeOS_SystemDirectory = 404
};
//nsSpecialSystemDirectory();