pawn-lang / compiler

Pawn compiler for SA-MP with bug fixes and new features - runs on Windows, Linux, macOS
Other
305 stars 72 forks source link

Recursive relative include doesn't change CWD when using forward slash #58

Closed Misiur closed 6 years ago

Misiur commented 9 years ago

Assume a matryoshka of kinds:

- test.pwn
- level_1
-- test.inc
-- level_2
--- test.inc
--- level_3
---- test.inc

When using backslash to specify path to included file, everything is nice. However, only that setup will work:

test.pwn

#include "level_1/test"

_level1/test.inc

#include "level_1\level_2/test"

_level2/test.inc

#include "level_1\level_2\level_3/test"

Is this intended behaviour?

oscar-broman commented 9 years ago

Nice culture reference!

Are you using compatibility mode, and on which OS are you compiling? See this discussion: https://github.com/Zeex/pawn/commit/d0f3a9a8df277265291a7ce2b0c9623b3c4a47b1#commitcomment-10583578

Misiur commented 9 years ago

Win 7 x64, no #pragma compat 1 and/or -Z+ flag in sight.

I'll try this commit If my msvc can do it.

e: Used the AppVeyor build, no dice.

oscar-broman commented 9 years ago

I guess the issue is where it searches backwards for the dirsep. It should search for both, but either / or \ appears to be hardcoded in some places.

Zeex commented 9 years ago

What exactly doesn't work here?

Misiur commented 9 years ago

When file is included with / as path separator, the files included from it aren't aware that they are in a folder.

Misiur commented 9 years ago

Hey, any news? Need some packaged example to investigate? I got somewhere near plungequalifiedfile, but no dice.

Y-Less commented 9 years ago

Just to point out, most of YSI exploits this. So if you fix it you will need to modify the affected includes.