[racket] Distributions and paths

From: Matthew Flatt (mflatt at cs.utah.edu)
Date: Wed Jul 7 08:49:52 EDT 2010

[Re-ordered questions]

At Wed, 7 Jul 2010 14:34:51 +0200, Laurent wrote:
> When the executable is launched, why does it not simply set the
> current-directory to the root of the distribution, 

Many executables use the current directory to perform their work. For
example, `raco exe prog.rkt' creates an executable from "prog.rkt" in
the current directory, rather than forcing you to provide a complete
pat for "prog.rkt".

> so the executable can be
> moved, depending on the OS?

The executable can be moved, as long as the rest of the tree is moved
with it. All path computations via `define-runtime-path' are relative
to the executable.

> I find the directory hierarchy that `assemble-distribution' creates a bit
> disturbing (using runtime-paths):
> - Why does the absolute path of my project appear in the distribution? I
> wouldn't like a software I distribute to carry such information.

Yes, that should be fixed. Can you tell me more about where it appears?

(If a full path appears in the source, I'm not sure I can fix it, but
I'm guessing that there's some other problem.)

> - Why are my "img\", "docs\" and other subdirectories buried to a
> (sub)^10-directory? I'd prefer them to remain simple sub-directories.
> I'm happy with runtime-paths talking care of copying all the required files,
> and I understand runtime-paths ensure consistency across multiple OSes, but
> I don't see why this implies such a complicated hierarchy for relative
> sub-directories.

For a Unix distribution, the expectation of some users is that they can
unpack it in "/usr/local", the package's files will go to the right
place, and the installation won't stomp on other installed software ---
including, perhaps, other Racket-based software.

Some layers of paths that you see keep files distinct while following
common directory conventions. Some other layers avoid collisions
between different files with the same name included by
`define-runtime-path' Finally, some layers keep files that Racket needs
separate from files included via `define-runtime-path'.

Posted on the users mailing list.