NetSurf
Functions
findfile.c File Reference
#include <winsock2.h>
#include <windows.h>
#include <limits.h>
#include <unistd.h>
#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "utils/log.h"
#include "utils/url.h"
#include "utils/utils.h"
#include "utils/filepath.h"
#include "windows/findfile.h"
Include dependency graph for findfile.c:

Go to the source code of this file.

Functions

char ** nsws_init_resource (const char *resource_path)
 Create an array of valid paths to search for resources. More...
 
static char * realpath (const char *path, char *resolved_path)
 
char * nsws_find_resource (char *buf, const char *filename, const char *def)
 Locate a shared resource file by searching known places in order. More...
 

Function Documentation

◆ nsws_find_resource()

char * nsws_find_resource ( char *  buf,
const char *  filename,
const char *  def 
)

Locate a shared resource file by searching known places in order.

Search order is: ~/.netsurf/, $NETSURFRES/ (where NETSURFRES is an environment variable), then the path specified in NETSURF_WINDOWS_RESPATH in the Makefile then .\res\ [windows paths]

Parameters
bufbuffer to write to. must be at least PATH_MAX chars
filenamefile to look for
defdefault to return if file not found
Returns
The passed in buffer

Definition at line 96 of file findfile.c.

References NSLOG, PATH_MAX, realpath(), and SLEN.

Here is the call graph for this function:

◆ nsws_init_resource()

char ** nsws_init_resource ( const char *  resource_path)

Create an array of valid paths to search for resources.

The idea is that all the complex path computation to find resources is performed here, once, rather than every time a resource is searched for.

Definition at line 44 of file findfile.c.

References filepath_free_strvec(), filepath_generate(), and filepath_path_to_strvec().

Referenced by WinMain().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ realpath()

static char * realpath ( const char *  path,
char *  resolved_path 
)
static

Definition at line 76 of file findfile.c.

References path(), and PATH_MAX.

Referenced by nsws_find_resource().

Here is the call graph for this function:
Here is the caller graph for this function: