VM and .sources in separate dirs question

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
8 messages Options
Reply | Threaded
Open this post in threaded view
|

VM and .sources in separate dirs question

Dmitri Zagidulin
While editing an Updated Pharo by Example chapter, I came across this:

"The '.sources' file and the VM can be read-only, and can be shared between
different users. All of these files can be placed in the same directory, but it
is also possible to put the Virtual Machine and sources file in separate
directory where everyone has access to them."

Is this true, that you can keep the VM and .sources in different directories? How do you tell the VM where to locate the sources? I assume it's some sort of commandline parameter?
Reply | Threaded
Open this post in threaded view
|

Re: VM and .sources in separate dirs question

Max Leske

> On 03 Apr 2015, at 16:16, Dmitri Zagidulin <[hidden email]> wrote:
>
> While editing an Updated Pharo by Example chapter, I came across this:
>
> "The '.sources' file and the VM can be read-only, and can be shared between
> different users. All of these files can be placed in the same directory, but it
> is also possible to put the Virtual Machine and sources file in separate
> directory where everyone has access to them."
>
> Is this true,

yes ;)

> that you can keep the VM and .sources in different directories? How do you tell the VM where to locate the sources?

You don’t. It’s detected automagically!

> I assume it's some sort of commandline parameter?

Cheers,
Max


Reply | Threaded
Open this post in threaded view
|

Re: VM and .sources in separate dirs question

Dmitri Zagidulin
On Fri, Apr 3, 2015 at 11:49 AM, Max Leske <[hidden email]> wrote:
> that you can keep the VM and .sources in different directories? How do you tell the VM where to locate the sources?

You don’t. It’s detected automagically!

Wait, how does it know which .sources file to pick? :) What if there are .sources from multiple versions of Pharo, etc, lying around on the hard drive? 

Reply | Threaded
Open this post in threaded view
|

Re: VM and .sources in separate dirs question

Max Leske

On 03 Apr 2015, at 17:55, Dmitri Zagidulin <[hidden email]> wrote:

On Fri, Apr 3, 2015 at 11:49 AM, Max Leske <[hidden email]> wrote:
> that you can keep the VM and .sources in different directories? How do you tell the VM where to locate the sources?

You don’t. It’s detected automagically!

Wait, how does it know which .sources file to pick? :) What if there are .sources from multiple versions of Pharo, etc, lying around on the hard drive? 


The image decides which sources file it needs. I have all of mine in a single directory with all the different VMs. Works like a charm.
Reply | Threaded
Open this post in threaded view
|

Re: VM and .sources in separate dirs question

Jigyasa Grover
Thanks for the clarification Max.
I had the same doubt :)

On Fri, Apr 3, 2015 at 9:30 PM, Max Leske <[hidden email]> wrote:

On 03 Apr 2015, at 17:55, Dmitri Zagidulin <[hidden email]> wrote:

On Fri, Apr 3, 2015 at 11:49 AM, Max Leske <[hidden email]> wrote:
> that you can keep the VM and .sources in different directories? How do you tell the VM where to locate the sources?

You don’t. It’s detected automagically!

Wait, how does it know which .sources file to pick? :) What if there are .sources from multiple versions of Pharo, etc, lying around on the hard drive? 


The image decides which sources file it needs. I have all of mine in a single directory with all the different VMs. Works like a charm.

Reply | Threaded
Open this post in threaded view
|

Re: VM and .sources in separate dirs question

Dmitri Zagidulin
In reply to this post by Max Leske
Do you happen to know how it does it? (I wouldn't know where to look, in the source code). Does it still work if you move the sources to another directory, from your current one? Does Pharo do a whole-disk search every time? (Or just when it doesn't find them?)

On Fri, Apr 3, 2015 at 12:00 PM, Max Leske <[hidden email]> wrote:

On 03 Apr 2015, at 17:55, Dmitri Zagidulin <[hidden email]> wrote:

On Fri, Apr 3, 2015 at 11:49 AM, Max Leske <[hidden email]> wrote:
> that you can keep the VM and .sources in different directories? How do you tell the VM where to locate the sources?

You don’t. It’s detected automagically!

Wait, how does it know which .sources file to pick? :) What if there are .sources from multiple versions of Pharo, etc, lying around on the hard drive? 


The image decides which sources file it needs. I have all of mine in a single directory with all the different VMs. Works like a charm.

Reply | Threaded
Open this post in threaded view
|

Re: VM and .sources in separate dirs question

Max Leske

On 03 Apr 2015, at 19:02, Dmitri Zagidulin <[hidden email]> wrote:

Do you happen to know how it does it? (I wouldn't know where to look, in the source code). Does it still work if you move the sources to another directory, from your current one? Does Pharo do a whole-disk search every time? (Or just when it doesn't find them?)

On Fri, Apr 3, 2015 at 12:00 PM, Max Leske <[hidden email]> wrote:

On 03 Apr 2015, at 17:55, Dmitri Zagidulin <[hidden email]> wrote:

On Fri, Apr 3, 2015 at 11:49 AM, Max Leske <[hidden email]> wrote:
> that you can keep the VM and .sources in different directories? How do you tell the VM where to locate the sources?

You don’t. It’s detected automagically!

Wait, how does it know which .sources file to pick? :) What if there are .sources from multiple versions of Pharo, etc, lying around on the hard drive? 

No, Pharo won’t search your disk, that would take way too long. Basically, the image tries to find the sources in two places:
1. the image directory
2. the vm directory

In reality Pharo tries to do a bit more. The places Pharo looks in are listed in OSPlatform>>potentialLocationsOfSourcesFile (and subclasses).

See also PharoFilesOpener>>openSources.

Note that the Pharo implementation has probably diverged a bit from the one that Squeak uses / used to use.

Cheers,
Max



The image decides which sources file it needs. I have all of mine in a single directory with all the different VMs. Works like a charm.


Reply | Threaded
Open this post in threaded view
|

Re: VM and .sources in separate dirs question

Dmitri Zagidulin
Ok, that's awesome. Thank you for explaining!

On Sat, Apr 4, 2015 at 8:50 AM, Max Leske <[hidden email]> wrote:

On 03 Apr 2015, at 19:02, Dmitri Zagidulin <[hidden email]> wrote:

Do you happen to know how it does it? (I wouldn't know where to look, in the source code). Does it still work if you move the sources to another directory, from your current one? Does Pharo do a whole-disk search every time? (Or just when it doesn't find them?)

On Fri, Apr 3, 2015 at 12:00 PM, Max Leske <[hidden email]> wrote:

On 03 Apr 2015, at 17:55, Dmitri Zagidulin <[hidden email]> wrote:

On Fri, Apr 3, 2015 at 11:49 AM, Max Leske <[hidden email]> wrote:
> that you can keep the VM and .sources in different directories? How do you tell the VM where to locate the sources?

You don’t. It’s detected automagically!

Wait, how does it know which .sources file to pick? :) What if there are .sources from multiple versions of Pharo, etc, lying around on the hard drive? 

No, Pharo won’t search your disk, that would take way too long. Basically, the image tries to find the sources in two places:
1. the image directory
2. the vm directory

In reality Pharo tries to do a bit more. The places Pharo looks in are listed in OSPlatform>>potentialLocationsOfSourcesFile (and subclasses).

See also PharoFilesOpener>>openSources.

Note that the Pharo implementation has probably diverged a bit from the one that Squeak uses / used to use.

Cheers,
Max



The image decides which sources file it needs. I have all of mine in a single directory with all the different VMs. Works like a charm.