Hi,

ok, I will answer argv[0], then :)

Esteban

El 03/01/2012, a las 3:00p.m., Eliot Miranda escribi�:

Hi Esteban,

    you'll find that my Mac VMs as of r2519 do "the right thing", agreeing with the linux VM.  See

http://www.squeakvm.org/svn/squeak/branches/Cog/platforms/Mac%20OS/vm/sqMacUnixCommandLineInterface.c

--- platforms/Mac OS/vm/sqMacUnixCommandLineInterface.c (revision 2515)
+++ platforms/Mac OS/vm/sqMacUnixCommandLineInterface.c (revision 2522)
@@ -63,14 +63,14 @@
 char *unixArgcInterfaceGetParm(int n) {
        int actual;
        
-       if (n < 0) 
+       if (n < 0) {
                actual = -n;
-       else
+               return actual < vmArgCnt ? vmArgVec[actual] : nil;
+       }
+       else {
                actual = n - 2;
-               
-       if (actual < squeakArgCnt) 
-               return squeakArgVec[actual];
-       return nil;
+               return actual < squeakArgCnt ? squeakArgVec[actual] : nil;
+       }
 }

And e.g.

$ oscogvm/macbuild/Fast.app/Contents/MacOS/Croquet -headless startreader.image foo bar baz
squeak> (0 to: -3 by: -1) collect: [:i| Smalltalk getSystemAttribute: i]!
#('oscogvm/macbuild/Fast.app/Contents/MacOS/Croquet' '-headless' 'startreader.image' nil)
squeak> (0 to: 5) collect: [:i| Smalltalk getSystemAttribute: i]!
#('oscogvm/macbuild/Fast.app/Contents/MacOS/Croquet' '/Users/eliot/Cog/startreader.image' 'foo' 'bar' 'baz' nil)
squeak> Smalltalk quit!
$
On Mon, Jan 2, 2012 at 8:04 AM, Esteban Lorenzano <estebanlm@gmail.com> wrote:
Hi,

I was trying to fix this, but seems to be a problem (besides the "'-psn_0_528513'", which is an error).
According SmalltalkImage>>#getSystemAttribute: comment, getSystemAttribute: 0 shouldn't answer the executable name, but the VM path:

     0               the full path name for currently executing VM
                      (or, on some platforms, just the path name of the VM's directory)

...so... getSystemAttribute: 0 is answering fine... and -1 should answer nil (or the vm parameters, if present), not the executable name. Real problem then is:

we don't have a way  to get the executable name

or

getSystemAttribute: comment is wrong :)

what's the audience opinion?

cheers,
Esteban


El 31/12/2011, a las 9:11p.m., Sean P. DeNigris escribi�:

> The latest blessed cocoa build from Jenkins (12/11/11 #10) + 1.3-rc returns:
>
> SmalltalkImage current getSystemAttribute: -1."'-psn_0_528513'"
> SmalltalkImage current getSystemAttribute: 0 "'/Applications'"
>
> There does not seem to be a way to get the vm executable name.
>
> Sean
>
> --
> View this message in context: http://forum.world.st/VM-Smalltalk-getSystemAttribute-tp4122708p4249718.html
> Sent from the Pharo Smalltalk mailing list archive at Nabble.com.
>





--
best,
Eliot