Problem Description
At the moment ASM6502 opens all included files relative to the current working dir. This leads to problems for example in the following case:
main.a65:
subdir/a.i65:
.include "b.i65" ; b.i65 in the same directory as a.i65
In this case b.i65 can not be loaded because it is searched in the directory of main.a65 and not within subdir.
Solution
This is tricky to solve in a standard-conformant C89 way without resorting implementation specific functions like POSIX, because the C standard has no knowledge of a) directory separators and b) directory change functions.
What it has is getenv to read environment variables. The most portable solution would be to introduce an environment variable ASM6502 including a search path. This PATH could then be searched if a file is not found in the current directory.
What remains are the different directory separators under different operating systems. The safest way to provide it is to define it via operating system specific makefile and pass it to the C compiler. Path scanning is a bad idea, because as an example RISC OS consideres . as path separator, clashing with the file extension under other operating systems.
Problem Description
At the moment ASM6502 opens all included files relative to the current working dir. This leads to problems for example in the following case:
main.a65:
subdir/a.i65:
In this case b.i65 can not be loaded because it is searched in the directory of main.a65 and not within subdir.
Solution
This is tricky to solve in a standard-conformant C89 way without resorting implementation specific functions like POSIX, because the C standard has no knowledge of a) directory separators and b) directory change functions.
What it has is getenv to read environment variables. The most portable solution would be to introduce an environment variable ASM6502 including a search path. This PATH could then be searched if a file is not found in the current directory.
What remains are the different directory separators under different operating systems. The safest way to provide it is to define it via operating system specific makefile and pass it to the C compiler. Path scanning is a bad idea, because as an example RISC OS consideres . as path separator, clashing with the file extension under other operating systems.