BRL-CAD
brlcad_path.c File Reference

A support routine to provide the executable code with the path to where the BRL-CAD programs and libraries are installed. More...

#include "common.h"
#include <stdlib.h>
#include <string.h>
#include "bio.h"
#include "bu/debug.h"
#include "bu/file.h"
#include "bu/log.h"
#include "bu/malloc.h"
#include "bu/str.h"
#include "bu/vls.h"
#include "sysv.h"
#include "brlcad_version.h"
Include dependency graph for brlcad_path.c:

Go to the source code of this file.

Macros

#define BRLCAD_ROOT   "/usr/brlcad"
 
#define MAX_WHERE_SIZE   (size_t)((MAXPATHLEN*2) + 64)
 
#define BPC   "/src/libbu/" __FILE__
 

Functions

HIDDEN const char * _brlcad_data (void)
 
HIDDEN void root_missing (const char *paths)
 
HIDDEN void data_missing (const char *paths)
 
HIDDEN int find_path (char result[MAXPATHLEN], const char *lhs, const char *rhs, struct bu_vls *searched, const char *where)
 
const char * bu_brlcad_dir (const char *dirkey, int fail_quietly)
 
const char * bu_brlcad_root (const char *rhs, int fail_quietly)
 
const char * bu_brlcad_data (const char *rhs, int fail_quietly)
 

Detailed Description

A support routine to provide the executable code with the path to where the BRL-CAD programs and libraries are installed.

Report the relative paths being used to hold BRL-CAD applications, libraries, and data.

Recognized keys include:

bin - Directory containing binary applications lib - Directory containing libraries include - Directory containing headers data - Directory containing shared data share - Directory containing shared data doc - Directory containing documentation man - Directory containing Unix man pages

Returns
A STATIC buffer is returned. It is the caller's responsibility to call bu_strdup() or make other provisions to save the returned string, before calling again.

Definition in file brlcad_path.c.

Macro Definition Documentation

#define BRLCAD_ROOT   "/usr/brlcad"

Definition at line 45 of file brlcad_path.c.

Referenced by _brlcad_data(), bu_brlcad_root(), and root_missing().

#define MAX_WHERE_SIZE   (size_t)((MAXPATHLEN*2) + 64)

Definition at line 50 of file brlcad_path.c.

Referenced by bu_brlcad_data(), and bu_brlcad_root().

#define BPC   "/src/libbu/" __FILE__

Referenced by bu_brlcad_data().

Function Documentation

HIDDEN const char* _brlcad_data ( void  )

Definition at line 54 of file brlcad_path.c.

References BRLCAD_ROOT, BU_DIR_SEPARATOR, find_path(), and MAXPATHLEN.

Referenced by bu_brlcad_data(), and data_missing().

Here is the call graph for this function:

HIDDEN void root_missing ( const char *  paths)

print out an error/warning message if we cannot find the specified BRLCAD_ROOT (compile-time install path)

Definition at line 82 of file brlcad_path.c.

References BRLCAD_ROOT, and bu_log().

Referenced by bu_brlcad_root().

Here is the call graph for this function:

HIDDEN void data_missing ( const char *  paths)

print out an error/warning message if we cannot find the specified BRLCAD_DATA (compile-time install path)

Definition at line 110 of file brlcad_path.c.

References _brlcad_data(), and bu_log().

Referenced by bu_brlcad_data().

Here is the call graph for this function:

HIDDEN int find_path ( char  result[MAXPATHLEN],
const char *  lhs,
const char *  rhs,
struct bu_vls searched,
const char *  where 
)

put a left-hand and right-hand path together and test whether they exist or not.

Returns
boolean on whether a match was found.

Definition at line 141 of file brlcad_path.c.

References BU_DIR_SEPARATOR, bu_file_exists(), bu_log(), bu_strlcpy, bu_vls_strcat(), and memset().

Referenced by _brlcad_data(), bu_brlcad_data(), and bu_brlcad_root().

Here is the call graph for this function: