On 30 Sep 2014, at 4:04 pm, Chris Double chris.double@double.co.nz [self-interest] <self-interest@yahoogroups.com> wrote:

On Sun, Sep 28, 2014 at 8:06 PM, Chris Double <chris.double@double.co.nz> wrote:
> It would be great if it could live outside the hierarchy of Self core
> code if possible. Ideally loading the code from a path would register
> that path as the root of where it lives for transporter purposes. So
> if I do:
>
> bootstrap read: 'webserver' From: '~/src/self-webserver/'
>
> it would then know that '~/src/self-webserver' is where things should
> be written back too. I'm not sure how hard this would be as I haven't
> looked at that code at all.

I had a quick look at this and it gets the fileOut filename from the
module object. 'modules init parent' has a category for 'file naming'
that lists the methods that compute the filenames. The use the
'directory' slot of the module prepending 'bootstrap
selfObjectsWorkingDir', The latter is the './objects' directory of the
running Self instance.

It should be possible to modify this such that it can know where the
module was originally loaded from and write back to that location. Is
this worth doing?

This will mean an image, if copied to another Self directory, and then
filed out will write back to the original location which is probably
not what we want though. Any thoughts on the best way of dealing with
this?

How about each module object has an extra slot: a name of the module tree it comes from. Then at fileOut we look up in a dictionary the directory where that module tree lives (and prompt if we don't know), and use that to compute the full filename. If the module doesn't know what tree it is from, we default to the Self working dir so existing behaviour is maintained.

module trees add: (module tree copyName: 'webserver' Location: '~/src/self-webserver').
bootstrap read: 'webserver' FromTree: (module trees at: 'webserver') Offset: ''

Russell