Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement include search path #13

Open
boeckmann opened this issue Apr 13, 2023 · 1 comment
Open

Implement include search path #13

boeckmann opened this issue Apr 13, 2023 · 1 comment
Assignees
Labels
enhancement New feature or request

Comments

@boeckmann
Copy link
Owner

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:

.include "subdir/a.i65"

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.

@boeckmann boeckmann added the enhancement New feature or request label Apr 13, 2023
@boeckmann boeckmann self-assigned this Apr 13, 2023
@waltje
Copy link

waltje commented Apr 13, 2023 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants