How Should Relative Paths Be Interpreted On The Command Line?

In Rebmake, you specify the path on the command line to make.r, and then you might specify other paths. For example, to a config:

$ ../somewhere/r3 ../../somewhere-else/make.r CONFIG=../configs/some-config.r

What happens is that system/options/boot will try its best to get a full path to wherever the r3 was.

Next, the make.r script will be found, and it changes the current directory to the directory the script is in. The rationale for this change is that you can easily write that script to talk about files relative to its location without qualifying them. That makes sense.

What to make of the CONFIG's relative path, then? Intuitively it seems those paths should be relative to wherever you were at the moment you ran the command...because it's all part of the same command line.

Yet under this set of circumstances, you've been changed into the directory of the script by the time it gets a chance to process the config. It would thus interpret the above as ../../somewhere-else/../configs/some-config.r

Could Someone Research Precedent For Handling This?

My instincts are that command line arguments should be interpreted relatively to system/options/path, e.g. wherever you spawned r3 from.

Does anyone disagree with this being the general rule? Do any programs give other precedent?

2 Likes

Off the cuff I can't think of any.