FreeBASIC  0.91.0
sys_exepath.c
Go to the documentation of this file.
1 /* exepath$ */
2 
3 #include "fb.h"
4 #ifdef HOST_WIN32
5  #include <windows.h>
6 #endif
7 
9 {
10  FBSTRING *dst;
11  char *p;
12  char tmp[MAX_PATH+1];
13  ssize_t len;
14 
15  p = fb_hGetExePath( tmp, MAX_PATH );
16 
17  if( p != NULL )
18  {
19  /* alloc temp string */
20  len = strlen( tmp );
21  dst = fb_hStrAllocTemp( NULL, len );
22  if( dst != NULL )
23  {
24  fb_hStrCopy( dst->data, tmp, len );
25  }
26  else
27  dst = &__fb_ctx.null_desc;
28  }
29  else
30  dst = &__fb_ctx.null_desc;
31 
32  return dst;
33 }