This is Unofficial EPICS BASE Doxygen Site
osiFileName.h File Reference
#include <libComAPI.h>
+ Include dependency graph for osiFileName.h:

Go to the source code of this file.

Macros

#define OSI_PATH_LIST_SEPARATOR   ";"
 
#define OSI_PATH_SEPARATOR   "\\"
 

Functions

LIBCOM_API char * epicsGetExecName (void)
 
LIBCOM_API char * epicsGetExecDir (void)
 

Macro Definition Documentation

#define OSI_PATH_LIST_SEPARATOR   ";"

Definition at line 23 of file osiFileName.h.

#define OSI_PATH_SEPARATOR   "\\"

Definition at line 24 of file osiFileName.h.

Function Documentation

LIBCOM_API char* epicsGetExecDir ( void  )

Return the absolute path of the directory containing the current executable.

Returns
NULL or the path. Caller must free()

Definition at line 38 of file osdgetexec.c.

39 {
40  char *ret = epicsGetExecName();
41  if(ret) {
42  char *sep = strrchr(ret, '/');
43  if(sep) {
44  /* nil the charactor after the / */
45  sep[1] = '\0';
46  }
47  }
48  return ret;
49 }
char * epicsGetExecName(void)
Definition: osdgetexec.c:9
LIBCOM_API char* epicsGetExecName ( void  )

Return the absolute path of the current executable.

Returns
NULL or the path. Caller must free()

Definition at line 9 of file osdgetexec.c.

10 {
11  uint32_t max = 64u;
12  char *ret = NULL;
13 
14  while(1) {
15  char *temp = realloc(ret, max);
16  if(!temp) {
17  /* we treat alloc failure as terminal */
18  free(ret);
19  ret = NULL;
20  break;
21  }
22  ret = temp;
23 
24  /* cf. "man 3 dyld" */
25  if(_NSGetExecutablePath(ret, &max)==0) {
26  /* max left unchanged */
27  ret[max-1] = '\0';
28  break;
29  }
30  /* max has been updated with required size */
31  }
32 
33  /* TODO: _NSGetExecutablePath() doesn't follow symlinks */
34 
35  return ret;
36 }
#define max(x, y)
Definition: flexdef.h:81
#define NULL
Definition: catime.c:38