REBOL 3.0

Relative filenames - relative to what?

Carl Sassenrath, CTO
REBOL Technologies
4-Aug-2009 2:17 GMT

Article #0227
Main page || Index || Prior Article [0226] || Next Article [0228] || 8 Comments || Send feedback

In R2 relative file names are relative to system/script/path.

In R3 A77, they will be relative to the current directory (from calling the OS).

So, which is best for R3?

Update (5-Aug):

Ok, to clarify:

When any file or directory action is used (READ, WRITE, OPEN, etc.), if a relative path is given, it is converted to an absolute path in order to check security (within whatever sandbox policies you've set up.)

This conversion requires an absolute path, which is obtained from the "current directory". This is a "process state variable." It can be stored in one of two places: in a REBOL object or in the OS. As long as the CHANGE-DIR function is being used, those two should, in theory, be identical. (Which is why you don't notice that R2 actually manages it's own copy.)

However, as Kaj points out, nearly all other languages use the OS value. This issue is important for a few reasons:

  1. consistency with launched subprocesses that use the OS current dir.
  2. some debug tools and monitors show the current dir.
  3. some OSes let you change-dir a running process (for whatever reason).

There may be additional issues, which is why I'm posting this for comments.

8 Comments

REBOL 3.0
Updated 27-Dec-2024 - Edit - Copyright REBOL Technologies - REBOL.net