[Vm-dev] Extending primitiveDirectoryEntry

Juan Vuletich JuanVuletich at zoho.com
Mon Apr 24 20:32:51 UTC 2017


On 4/24/2017 11:26 AM, Alistair Grant wrote:
> ...
> Pharo uses the image directory as its current working directory.  If you
> supply a relative path, it is resolved against the image directory.
>
> I find this a bit unintuitive, I'd expect the defaultWorkingDirectory to
> be the same as the parent process, e.g. the result of running pwd in a
> shell.  But changing it now would probably break a lot of code.

In Cuis I did as you say. For instance,
           juan at juani5:~$ pwd
           /home/juan

Starting the image like:
           juan at juani5:~$ Rectifier/cogspur64/squeak 
Rectifier/Cuis-Smalltalk-Dev/Cuis5.0-3076-spur-64.image

And then, in Smalltalk,
           './' asDirectoryEntry

evaluates to
           /home/juan

This is the comment for #currentDirectory
     "Answer the current directory.
     In Unix it is the current directory in the OS shell that started us.
     In Windows the same happens if the image file is in a subree of the 
Windows current directory."

For additional details, check in Cuis.

This has proved to be extremely useful for writing command line 
applications that integrate nicely with Bash, for instance an 
orthorectifier for satellite images.

Cheers,

-- 
Juan Vuletich
www.cuis-smalltalk.org
https://github.com/Cuis-Smalltalk/Cuis-Smalltalk-Dev
@JuanVuletich




More information about the Vm-dev mailing list