Next: , Previous: , Up: ref-fdi   [Contents][Index]


4.5.2 Syntactic Rewriting

A file specification must be an atom or a compound term with arity 1. Such compound terms are transformed to atoms as described in ref-fdi-fsp. Let FileSpec be the given or transformed atomic file specification.

A file specification FileSpec is subject to syntactic rewriting. Depending on the operation, the resulting absolute filename is subject to further processing. Syntactic rewriting is performed wrt. a context directory Context (an absolute path), in the following steps:

The following UNIX examples assumes that Context is ‘/usr/’; that the environment variables VAR1, VAR2, VAR3 have the values ‘/opt/bin’, ‘foo’ and ‘~/temp’ respectively and that the home directory of the current user, ‘joe’, is ‘/home/joe’.


/foo/bar
   → /foo/bar

/foo/.//bar/../blip///
   → /foo/blip

/foo//../bar/../../blip
   → error

$VAR1/../local/
   → /opt/local

$VAR2/misc/.
   → /usr/foo/misc

$VAR3/misc/.
   → /home/joe/temp/misc

~joe/../jenny/bin.
   → /home/jenny/bin

The following Windows examples assume that Context is ‘C:/Source/proj1’; that the environment variables VAR1, VAR2, VAR3 have the values ‘\\server\docs\brian’, ‘foo’ and ‘~/temp’ respectively and that the home directory of the current user is ‘C:/home’.


/foo/bar
   → c:/foo/bar

foo//../../blip
   → c:/source/blip

$VAR1/../local/
   → //server/docs/local

$VAR2/misc/.
   → c:/source/proj1/foo/misc

$VAR3/misc/.
   → c:/home/temp/misc

~joe/../jenny/bin.
   → error



Send feedback on this subject.