Fixes being unable to use the compiler when

installed in the system.
This commit is contained in:
John Schneiderman 2024-08-11 13:41:55 +02:00
parent 32c090880b
commit f9afb3edb7

View File

@ -113,7 +113,30 @@ int main2(int argc, const char** argv)
compiler->mPreprocessor->AddPath(basePath); compiler->mPreprocessor->AddPath(basePath);
strcpy_s(includePath, basePath); strcpy_s(includePath, basePath);
{
FILE* crtFile;
char crtFileNamePath[FILENAME_MAX];
crtFileNamePath[FILENAME_MAX - 1] = '\0';
strcpy_s(crtFileNamePath, basePath);
strcat_s(crtFileNamePath, "include/crt.h");
if ((crtFile = fopen(crtFileNamePath, "r")))
strcat_s(includePath, "include/"); strcat_s(includePath, "include/");
else
{
strcpy_s(crtFileNamePath, basePath);
strcat_s(crtFileNamePath, "include/oscar64/crt.h");
if ((crtFile = fopen(crtFileNamePath, "r")))
strcat_s(includePath, "include/oscar64/");
else
{
printf("Could not locate Oscar64 includes under %s\n", basePath);
return 20;
}
}
fclose(crtFile);
}
compiler->mPreprocessor->AddPath(includePath); compiler->mPreprocessor->AddPath(includePath);
strcpy_s(crtPath, includePath); strcpy_s(crtPath, includePath);
strcat_s(crtPath, "crt.c"); strcat_s(crtPath, "crt.c");