I think I have this working now :-)<div><br></div><div>I had to make two changes to dyre:</div><div><br></div><div>- In Config.Dyre, I removed lines 188 to 191 which delete &quot;errors.txt&quot;. This was failing as the file was still open for lazy reading.</div>
<div><br></div><div>- In Config.Dyre.Paths, I changed line 28 to:</div><div><br></div><div><div>    let tempBinary = cacheDir &lt;/&gt; pName ++ &quot;-&quot; ++ os ++ &quot;-&quot; ++ arch &lt;.&gt; takeExtension thisBinary</div>
<div><br></div><div>This added the necessary &quot;.exe&quot; extension to the program filename. GHC adds this extension anyway, but in various places dyre checks to see whether the file exists which was failing as it was looking for the file without the extension. Perhaps there is a better way to get the appropriate extension for executables on the given os, but I couldn&#39;t think of one.</div>
<div><br></div><div>I think both of these changes should work on Linux, but haven&#39;t tested yet. I&#39;ve cc&#39;d Will on this as I think these changes (or some variation) should be incorporated into dyre.</div><div><br>
</div><div>Now to actually build a useful config file...</div><div><br></div><div>Peter</div><br><div class="gmail_quote">On 14 October 2010 19:41, Peter Marks <span dir="ltr">&lt;<a href="mailto:peter@indigomail.net">peter@indigomail.net</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">&gt; Are you sure that Yi ever writes a default config file?<div><br></div></div><div>If you start Yi with no config file, press any key, press &quot;h&quot;, choose a key binding, then save the file, you get a file c:\Users\peter\.yi\yi.hs</div>
<div class="im">
<div><br></div><div>&gt; If dyre defaults to using a directory that doesn&#39;t exist on 7, I&#39;d say</div>that&#39;s a bug in dyre. We should probably tell Will Donnelly (the<br>maintainer) if that&#39;s correct.<div>
<br>
</div></div><div>Hmm, although what I said is correct, it is not causing this problem. Windows 7 does use a different directory for local user data, but it implements some magic to make references to the old location access the new location. If you do a dir of &quot;C:\Users\peter&quot;, &quot;Local Settings&quot; doesn&#39;t exist, but if you dir &quot;C:\Users\peter\Local Settings\Cache\yi&quot;, you actually get the contents of &quot;C:\Users\peter\AppData\Local\Cache\yi&quot;, which does contain the file &quot;errors.txt&quot;! It is a sort of invisible simlink.</div>

<div><br></div><div>The actual problem I am having is that dyre tries to delete &quot;errors.txt&quot; straight after reading it with readFile. As readFile is lazy, the runtime is keeping the file open so, on Windows at least, it can&#39;t be deleted. I&#39;m not really sure why it wants to delete the file though. I guess it is so that any warning messages are only shown the first time you launch after a compile, then deleted. I don&#39;t see why the errors file can&#39;t just be left so that you see errors whenever you launch. I&#39;ll try changing this later this evening (UK) and let you know if it works. The alternative would be to force the file to be read strictly then closed.</div>

<div><br></div><font color="#888888"><div><br></div><div>Peter</div></font><div><div></div><div class="h5"><div><div><br><br><div class="gmail_quote">On 14 October 2010 00:53, Jeff Wheeler <span dir="ltr">&lt;<a href="mailto:wheele11@illinois.edu" target="_blank">wheele11@illinois.edu</a>&gt;</span> wrote:<br>

<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div>On Wed, Oct 13, 2010 at 6:14 PM, Peter Marks &lt;<a href="mailto:peter@indigomail.net" target="_blank">peter@indigomail.net</a>&gt; wrote:<br>


<br>
&gt; The problem is down to getAppUserDataDirectory called in Yi.Boot. This<br>
&gt; function behaves differently on Windows to Linux... and more so on Windows<br>
&gt; 7. The first issue is that on Windows it doesn&#39;t prepend the &quot;.&quot; to the<br>
&gt; directory name, so it is looking in &quot;yi&quot;, not &quot;.yi&quot;. On Windows 7, it looks<br>
&gt; for this directory in a completely different location:<br>
&gt; &quot;C:\Users\peter\AppData\Roaming&quot; rather than just &quot;C:\Users\peter&quot;.<br>
<br>
</div>This sounds right.<br>
<div><br>
&gt; Obviously other parts of the program are using a different call to locate<br>
&gt; the config file as, letting the editor create the default file, it places it<br>
&gt; in &quot;C:\Users\peter\.yi\yi.hs&quot;! I can&#39;t find the code that does this at the<br>
&gt; moment - any pointers appreciated.<br>
<br>
</div>Are you sure that Yi ever writes a default config file? As far as I<br>
know, when dyre provides no config from reading a file (or resuming a<br>
saved state), Yi will boot with Yi.Config.Default.defaultConfig<br>
(that&#39;s the one that lets you enter vim or emacs keybindings with &#39;v&#39;<br>
and &#39;e&#39; respectively), but I don&#39;t think it ever writes this to a<br>
file. (Note that src/Main.hs calls this; it might make sense to remove<br>
that file and move this to Yi.Main or Yi.Boot.)<br>
<div><br>
&gt; My current feeling is that getAppUserDataDirectory is the correct call to<br>
&gt; use and the docs should be changed to tell users to put their file where<br>
&gt; this call points. Further, it would be nice if the editor told you where it<br>
&gt; was looking if it doesn&#39;t find a config file... well actually, when it does<br>
&gt; find a file too, so you know which one it loaded.<br>
<br>
</div>I&#39;m in favor of printing it when an error occurs (should no config be<br>
an error? not sure, but I&#39;d be inclined to say no). When Yi boots<br>
correctly, I&#39;d prefer to not print anything.<br>
<br>
Or, better yet, just always include it in --debug.<br>
<div><br>
&gt; Now I&#39;m on to the next problem, it tries to write its error file in a<br>
&gt; location that doesn&#39;t exist: &quot;C:\Users\peter\Local<br>
&gt; Settings\Cache\yi\errors.log&quot;. &quot;Local Settings&quot; doesn&#39;t exist on Windows 7.<br>
&gt; This is now &quot;AppData\Local&quot; I think. Setting the cacheDir field of the dyre<br>
&gt; Params should fix this, but I don&#39;t have time to try it right now.<br>
<br>
</div>If dyre defaults to using a directory that doesn&#39;t exist on 7, I&#39;d say<br>
that&#39;s a bug in dyre. We should probably tell Will Donnelly (the<br>
maintainer) if that&#39;s correct.<br>
<br>
Again, thanks so much for looking at this.<br>
<font color="#888888"><br>
--<br>
</font><div><div></div><div>Jeff Wheeler<br>
<br>
Undergraduate, Electrical Engineering<br>
University of Illinois at Urbana-Champaign<br>
_______________________________________________<br>
Haskell-Cafe mailing list<br>
<a href="mailto:Haskell-Cafe@haskell.org" target="_blank">Haskell-Cafe@haskell.org</a><br>
<a href="http://www.haskell.org/mailman/listinfo/haskell-cafe" target="_blank">http://www.haskell.org/mailman/listinfo/haskell-cafe</a><br>
</div></div></blockquote></div><br></div></div>
</div></div></blockquote></div><br></div>