Hi Ben,
yes... to answer full file name is easy... my question is because the VM
doesn't do that, and it has an explicit transformation to avoid answer that...
then I wonder if that would be on purpose, and why.
One thing that comes to my mind is that, in macs, a program is a directory, for
example, vm would be: /path/to/Cog.app/, then the real executable is placed
inside this directory following a convention: MyApp.app/Contents/MacOS/MyApp
So, question is: from mac point of view... which one is the "full path"?
/path/to/Cog.app or /path/to/Cog.app/Contents/MacOS/Cog?
cheers,
Esteban
El 03/01/2012, a las 9:54a.m., Ben Coman escribió:
> 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
>>>>
>>>> or
>>>>
>>>> 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[0], 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 :(
>>
>> Esteban
>>
>>
>>
> Esteban,
> I am not sure of the semantics within Smalltalk, but within both Windows &
> Linux "full path" includes the filename. Examples...
>
> Linux `which` command [1]
> "...printing the full path when used from a script"
> > echo `which q2`
> /home/carlo/bin/q2
>
> Windows Path.GetFullPath method [2]
> "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.
>
> cheers, Ben
>
> [1] http://linux.die.net/man/1/which
> [2] http://msdn.microsoft.com/en-us/library/system.io.path.getfullpath.aspx
> [3]
> http://stackoverflow.com/questions/799679/programatically-retrieving-the-absolute-path-of-an-os-x-command-line-app
> [4]
> http://stackoverflow.com/questions/1023306/finding-current-executables-path-without-proc-self-exe
> [5]
> http://stackoverflow.com/questions/933850/how-to-find-the-location-of-the-executable-in-c
> [6]
> http://stackoverflow.com/questions/3200651/application-path-location-in-ms-windows
>
>
>