mirror of
https://github.com/netsurf-browser/netsurf
synced 2024-12-17 17:52:43 +03:00
beos: Use PathFinder to locate resource folder.
So it can work wherever NetSurf is installed... Note this uses a Haiku-specific API and definitely breaks BeOS build.
This commit is contained in:
parent
d64fa80ba7
commit
80cc326658
17
beos/gui.cpp
17
beos/gui.cpp
@ -37,6 +37,7 @@
|
|||||||
#include <FindDirectory.h>
|
#include <FindDirectory.h>
|
||||||
#include <Mime.h>
|
#include <Mime.h>
|
||||||
#include <Path.h>
|
#include <Path.h>
|
||||||
|
#include <PathFinder.h>
|
||||||
#include <Roster.h>
|
#include <Roster.h>
|
||||||
#include <Screen.h>
|
#include <Screen.h>
|
||||||
#include <String.h>
|
#include <String.h>
|
||||||
@ -79,9 +80,6 @@ extern "C" {
|
|||||||
|
|
||||||
static void *myrealloc(void *ptr, size_t len, void *pw);
|
static void *myrealloc(void *ptr, size_t len, void *pw);
|
||||||
|
|
||||||
/* Where to search for shared resources. Must have trailing / */
|
|
||||||
#define RESPATH "/boot/apps/netsurf/res/"
|
|
||||||
|
|
||||||
//TODO: use resources
|
//TODO: use resources
|
||||||
// enable using resources instead of files
|
// enable using resources instead of files
|
||||||
#define USE_RESOURCES 1
|
#define USE_RESOURCES 1
|
||||||
@ -297,7 +295,13 @@ static char *find_resource(char *buf, const char *filename, const char *def)
|
|||||||
return buf;
|
return buf;
|
||||||
}
|
}
|
||||||
|
|
||||||
strcpy(t, RESPATH);
|
|
||||||
|
BPathFinder f((void*)find_resource);
|
||||||
|
|
||||||
|
BPath p;
|
||||||
|
f.FindPath(B_FIND_PATH_APPS_DIRECTORY, "netsurf/res/", p);
|
||||||
|
strcpy(t, p.Path());
|
||||||
|
|
||||||
strcat(t, filename);
|
strcat(t, filename);
|
||||||
realpath(t, buf);
|
realpath(t, buf);
|
||||||
if (access(buf, R_OK) == 0)
|
if (access(buf, R_OK) == 0)
|
||||||
@ -488,7 +492,10 @@ static bool nslog_stream_configure(FILE *fptr)
|
|||||||
|
|
||||||
static BPath get_messages_path()
|
static BPath get_messages_path()
|
||||||
{
|
{
|
||||||
BPath p("/boot/apps/netsurf/res");
|
BPathFinder f((void*)get_messages_path);
|
||||||
|
|
||||||
|
BPath p;
|
||||||
|
f.FindPath(B_FIND_PATH_APPS_DIRECTORY, "netsurf/res", p);
|
||||||
// TODO: use Haiku's BLocale stuff
|
// TODO: use Haiku's BLocale stuff
|
||||||
BString lang(getenv("LC_MESSAGES"));
|
BString lang(getenv("LC_MESSAGES"));
|
||||||
lang.Truncate(2);
|
lang.Truncate(2);
|
||||||
|
Loading…
Reference in New Issue
Block a user