48 const char *lang = NULL;
57 winpath = malloc(MAX_PATH);
58 GetModuleFileName(NULL, winpath, MAX_PATH);
59 slsh = strrchr(winpath,
'\\');
62 strncat(winpath,
"\\windows\\res", MAX_PATH);
65 while (pathv[pathi] != NULL)
67 pathv[pathi] = winpath;
98 char *cdir = getenv(
"HOME");
102 NSLOG(netsurf, INFO,
"Found Home %s", cdir);
104 strcat(t,
"/.netsurf/");
106 if ((
realpath(t, buf) != NULL) && (access(buf, R_OK) == 0))
110 cdir = getenv(
"NETSURFRES");
115 strcat(buf, filename);
116 if (access(buf, R_OK) == 0)
121 strcpy(t, NETSURF_WINDOWS_RESPATH);
123 if ((
realpath(t, buf) != NULL) && (access(buf, R_OK) == 0))
126 getcwd(t,
PATH_MAX -
SLEN(
"\\res\\") - strlen(filename));
127 strcat(t,
"\\res\\");
129 NSLOG(netsurf, INFO,
"looking in %s", t);
130 if ((
realpath(t, buf) != NULL) && (access(buf, R_OK) == 0))
134 snprintf(t,
PATH_MAX,
"%s%s", getenv(
"HOME"), def + 1);
char ** filepath_path_to_strvec(const char *path)
Convert a colon separated list of path elements into a string vector.
void filepath_free_strvec(char **pathv)
Free a string vector.
char ** filepath_generate(char *const *pathv, const char *const *langv)
Merge two string vectors into a resource search path vector.
Utility routines to obtain paths to file resources.
#define NSLOG(catname, level, logmsg, args...)
Interface to utility string handling.
Interface to URL parsing and joining operations.
Interface to a number of general purpose functionality.
#define SLEN(x)
Calculate length of constant C string.
char * nsws_find_resource(char *buf, const char *filename, const char *def)
Locate a shared resource file by searching known places in order.
static char * realpath(const char *path, char *resolved_path)
char ** nsws_init_resource(const char *resource_path)
Create an array of valid paths to search for resources.
static nserror path(const struct redraw_context *ctx, const plot_style_t *pstyle, const float *p, unsigned int n, const float transform[6])
Plots a path.