[Pharo-project] [ VM ]Smalltalk getSystemAttribute:
btc at openInWorld.com
Tue Jan 3 07:54:18 EST 2012
Esteban Lorenzano wrote:
> El 02/01/2012, a las 4:39p.m., David T. Lewis escribió:
>>> Real problem then is:
>>> we don't have a way to get the executable name
>>> getSystemAttribute: comment is wrong :)
>> On a unix VM, it answers the full path to the executable, which is
>> in agreement with the comment. For example:
>> Smalltalk getSystemAttribute: 0 ==> '/usr/local/lib/squeak/4.7.18-2505/squeakvm'
>> Maybe is is more complicated for Mac, but wasn't there some discussion
>> about it on vm-dev a while back?
> I don't remember :)
> so, how can we solve this? of course, it is not a problem to make getSystemAttribute: 0 answer argv, but that's not the expected behavior... we can be making a mistake, because it should answer vm path, no vm fullName.
> I can add a 10XX number to answer vm full name, but that will lead to consistency problems inside the image...
> I really don't know how to proceed :(
I am not sure of the semantics within Smalltalk, but within both Windows
& Linux "full path" includes the filename. Examples...
Linux `which` command 
"...printing the full path when used from a script"
> echo `which q2`
Windows Path.GetFullPath method 
"Returns the absolute path for the specified path string."
// GetFullPath('mydir') returns 'C:\temp\Demo\mydir'
// GetFullPath('myfile.ext') returns 'C:\temp\Demo\myfile.ext'
From browsing around it does seem harder on OSX to determine the path
to the current executable [3,4,5,6] but I'm not qualified to comment.
More information about the Pharo-dev