<br><br><div class="gmail_quote">On Thu, May 19, 2011 at 5:06 AM, Bert Freudenberg <span dir="ltr">&lt;<a href="mailto:bert@freudenbergs.de">bert@freudenbergs.de</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<div class="im"><br>
<br>
On 19.05.2011, at 13:49, Stefan Marr wrote:<br>
<br>
&gt;<br>
&gt; Hi Esteban:<br>
&gt;<br>
&gt; I debugged a bit what is going on.<br>
&gt;<br>
&gt; The main issue seems to be that the VM changes its working directory.<br>
&gt; The reason seems to be that the loading mechanism for plugin depends on the wrong directory.<br>
&gt; At least, disabling the chdir leads to warnings like this: squeak: could not load plugin `FilePlugin&#39;.<br>
&gt;<br>
&gt; I don&#39;t really understand why that is the way to go. Actually I would expect that the application respects the current working directory and uses it as its own. At least as a command-line user, that&#39;s my expectation.<br>

<br>
</div>But a Mac OS X .app bundle is not a command line application. It expects the Resources directory to be the current directory. That is so that you can use relative paths to specify resources. I guess this is just a convention, though.<br>
</blockquote><div><br></div><div>I don&#39;t think so.  If one launches a .app with the open command (and indeed by clicking on a document which opens its associated app, or clicking on the app) then the current working directory is the root directory /.  One can find the Resources directory from the path of the executable which will be in Application.app/Contents/MacOS/theexe and so the Resources directory is parent(fullpath(theexe))/Resources.</div>
<div><br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<br>
I would expect more things to break if you change this. E.g., the SqueakImageName in Info.plist needs to be given as a relative path so that an &quot;all-in-one&quot; bundle works everywhere. It is relative to the Resources directory. I&#39;m not sure if the implementation relies on the cwd or if it actually expands the path relative to Resources.<br>
</blockquote><div><br></div><div>I think this can be fixed.  Just yesterday with the Newspeak VM I&#39;m working on I found that the chdir breaks a particular use of mercurial.  So at least in the Newspeak VM the chdir has been eliminated.</div>
<div>  </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<br>
Removing the chdir seems like a good idea, I&#39;m just saying that there may be more places relying on cwd == Resources.<br></blockquote><div><br></div><div>Agreed on both.</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">

<font color="#888888"><br>
- Bert -<br>
</font><div><div></div><div class="h5"><br>
&gt; So, the question is, how to fix it?<br>
&gt;<br>
&gt; On the upside, removing chdir seems to restore the expected behavior: at least it parses the arguments fine and accepts the image after a -headless even with a relative path. So, all necessary functionality is there, only the plugin loading would need adaptation.<br>

&gt;<br>
&gt; Best regards<br>
&gt; Stefan<br>
&gt;<br>
&gt; PS:<br>
&gt;<br>
&gt; The code is in sqMacMain.c around line 370:<br>
&gt;<br>
&gt; {<br>
&gt;       // Change working directory, this works under os-x, previous logic worked pre os-x 10.4<br>
&gt;<br>
&gt;       char target[4097],temp[4097];<br>
&gt;       getVMPathWithEncoding(target,gCurrentVMEncoding);<br>
&gt;       sqFilenameFromStringOpen(temp,(sqInt) target, strlen(target));<br>
&gt;       chdir(temp);<br>
&gt; }<br>
&gt;<br>
&gt;<br>
&gt;<br>
&gt;<br>
&gt; On 19 May 2011, at 01:24, Esteban Lorenzano wrote:<br>
&gt;<br>
&gt;&gt;<br>
&gt;&gt; Hi,<br>
&gt;&gt; Sorry for the delayed answer.<br>
&gt;&gt; Yes, there are problems with command line and osx vms. Yes... the cocoa versions are experimenting a lot of problems with it (well... more specifically, they are different than what users expect, and not all of them are present).<br>

&gt;&gt; I would like to unify the command line between osx, windows and linux vms... but I don&#39;t know where to start.<br>
&gt;&gt; If someone can point me in the right direction (which options should be present... maybe linux version should rule?), I will add this job to the &quot;infinite todo&quot; :)<br>
&gt;&gt;<br>
&gt;&gt; cheers,<br>
&gt;&gt; Esteban<br>
&gt;&gt;<br>
&gt;&gt; El 16/05/2011, a las 1:40p.m., Stefan Marr escribió:<br>
&gt;&gt;<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt; Hi:<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt; On 16 May 2011, at 18:19, Mariano Martinez Peck wrote:<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt;&gt; You have the .surces and .changes properly locacted, haven&#39;t you?  because otherwise you have a nice popup waiting for you ;)  but your are headless hheheh<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt; There is always room for me doing something stupid, but since the following works just fine with Eliot&#39;s Cog build, I assume it is a bug in the Mac VMs:<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt; smarr@minerva:~/tmp/pharo$ /Applications/Cog.app/Contents/MacOS/Croquet -headless  ~/tmp/pharo/Pharo-1.2.image HelloWorld<br>
&gt;&gt;&gt; Hello World!<br>
&gt;&gt;&gt; HelloWorld<br>
&gt;&gt;&gt; smarr@minerva:~/tmp/pharo$<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt; Bye the way, it would be awesome if there would be a platform independent way to produce newlines on the console...<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt; Best regards<br>
&gt;&gt;&gt; Stefan<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt; --<br>
&gt;&gt;&gt; Stefan Marr<br>
&gt;&gt;&gt; Software Languages Lab<br>
&gt;&gt;&gt; Vrije Universiteit Brussel<br>
&gt;&gt;&gt; Pleinlaan 2 / B-1050 Brussels / Belgium<br>
&gt;&gt;&gt; <a href="http://soft.vub.ac.be/~smarr" target="_blank">http://soft.vub.ac.be/~smarr</a><br>
&gt;&gt;&gt; Phone: <a href="tel:%2B32%202%20629%202974" value="+3226292974">+32 2 629 2974</a><br>
&gt;&gt;&gt; Fax:   <a href="tel:%2B32%202%20629%203525" value="+3226293525">+32 2 629 3525</a><br>
&gt;&gt;&gt;<br>
&gt;&gt;<br>
&gt;<br>
&gt; --<br>
&gt; Stefan Marr<br>
&gt; Software Languages Lab<br>
&gt; Vrije Universiteit Brussel<br>
&gt; Pleinlaan 2 / B-1050 Brussels / Belgium<br>
&gt; <a href="http://soft.vub.ac.be/~smarr" target="_blank">http://soft.vub.ac.be/~smarr</a><br>
&gt; Phone: <a href="tel:%2B32%202%20629%202974" value="+3226292974">+32 2 629 2974</a><br>
&gt; Fax:   <a href="tel:%2B32%202%20629%203525" value="+3226293525">+32 2 629 3525</a><br>
&gt;<br>
<br>
<br>
</div></div></blockquote></div><br>