From d0f3a9a8df277265291a7ce2b0c9623b3c4a47b1 Mon Sep 17 00:00:00 2001 From: Zeex Date: Tue, 31 Mar 2015 00:04:32 +0600 Subject: [PATCH] Allow use of backslash in #include in compatibility mode This allows you to use \ as a directory separator on non-Windows platforms. It was adopted from another patch by Slice: https://github.com/oscar-broman/pawn/commit/534cd028955449f3c0c92ac5d3dccbbeca8f101d --- source/compiler/sc2.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/source/compiler/sc2.c b/source/compiler/sc2.c index 93d321e..64dd1b4 100644 --- a/source/compiler/sc2.c +++ b/source/compiler/sc2.c @@ -264,6 +264,15 @@ static void doinclude(int silent) check_empty(lptr+1); /* verify that the rest of the line is whitespace */ if (pc_compat) { + /* convert backslash to native directory separators for maximum + * compatibility for the Windows compiler + */ + #if DIRSEP_CHAR!='\\' + ptr=name; + while ((ptr=strchr(ptr,'\\'))!=NULL) + *ptr++=DIRSEP_CHAR; + #endif + /* create a symbol from the name of the include file; this allows the system * to test for multiple inclusions */ @@ -3020,4 +3029,3 @@ static char itohstr[30]; *ptr='\0'; /* and a zero-terminator */ return itohstr; } -