mirror of
https://github.com/ZDoom/acc.git
synced 2024-11-14 16:41:01 +00:00
- Added the ACC program directory as an implicit include path.
SVN r1329 (trunk)
This commit is contained in:
parent
0157077f3f
commit
48694c4d3e
3 changed files with 47 additions and 1 deletions
2
acc.c
2
acc.c
|
@ -242,6 +242,8 @@ static void ProcessArgs(void)
|
|||
{
|
||||
DisplayUsage();
|
||||
}
|
||||
|
||||
TK_AddProgramIncludePath(ArgVector[0]);
|
||||
|
||||
if(count == 1)
|
||||
{
|
||||
|
|
45
token.c
45
token.c
|
@ -7,12 +7,18 @@
|
|||
|
||||
// HEADER FILES ------------------------------------------------------------
|
||||
|
||||
#if defined(_WIN32) && !defined(_MSC_VER)
|
||||
#define WIN32_LEAN_AND_MEAN
|
||||
#include <windows.h>
|
||||
#endif
|
||||
|
||||
#ifdef __NeXT__
|
||||
#include <libc.h>
|
||||
#else
|
||||
#ifndef unix
|
||||
#include <io.h>
|
||||
#endif
|
||||
#include <limits.h>
|
||||
#include <fcntl.h>
|
||||
#include <stdlib.h>
|
||||
#endif
|
||||
|
@ -305,7 +311,7 @@ static char *AddFileName(const char *name)
|
|||
|
||||
//==========================================================================
|
||||
//
|
||||
// AddIncludePath
|
||||
// TK_AddIncludePath
|
||||
// This adds an include path with less priority than the ones already added
|
||||
//
|
||||
// Pascal 12/11/08
|
||||
|
@ -329,6 +335,43 @@ void TK_AddIncludePath(char *sourcePath)
|
|||
}
|
||||
}
|
||||
|
||||
//==========================================================================
|
||||
//
|
||||
// TK_AddProgramIncludePath
|
||||
// Adds an include path for the directory of the executable.
|
||||
//
|
||||
//==========================================================================
|
||||
|
||||
void TK_AddProgramIncludePath(char *progname)
|
||||
{
|
||||
if(NumIncludePaths < MAX_INCLUDE_PATHS)
|
||||
{
|
||||
#ifdef _WIN32
|
||||
#ifdef _MSC_VER
|
||||
if (_get_pgmptr(&progname) != 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
#else
|
||||
char progbuff[1024];
|
||||
GetModuleFileName(0, progbuff, sizeof(progbuff));
|
||||
progbuff[sizeof(progbuff)-1] = '\0';
|
||||
progname = progbuff;
|
||||
#endif
|
||||
#else
|
||||
char progbuff[PATH_MAX];
|
||||
if (realpath(progname, progbuff) != NULL)
|
||||
{
|
||||
progname = progbuff;
|
||||
}
|
||||
#endif
|
||||
strcpy(IncludePaths[NumIncludePaths], progname);
|
||||
if(MS_StripFilename(IncludePaths[NumIncludePaths]))
|
||||
{
|
||||
NumIncludePaths++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//==========================================================================
|
||||
//
|
||||
|
|
1
token.h
1
token.h
|
@ -147,6 +147,7 @@ void TK_SkipLine(void);
|
|||
void TK_SkipPast(tokenType_t token);
|
||||
void TK_SkipTo(tokenType_t token);
|
||||
void TK_AddIncludePath(char *sourceName);
|
||||
void TK_AddProgramIncludePath(char *argv0);
|
||||
|
||||
// PUBLIC DATA DECLARATIONS ------------------------------------------------
|
||||
|
||||
|
|
Loading…
Reference in a new issue