<div dir="ltr">2013/4/14 Joe Armstrong <span dir="ltr"><<a href="mailto:erlang@gmail.com" target="_blank">erlang@gmail.com</a>></span><br><div class="gmail_extra"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div>I have a troublesome symlink that puts one of my programs into a loop</div><div><br></div><div>If I list the files in my troublesome directory I see this:</div><div><br></div><div><div>ls -l /Users/joe/projects/fuse/fuserl-2.0.5/fw</div>
<div>total 8</div><div>drwxr-xr-x@ 6 joe staff 204 Jul 23 2009 bin</div><div>drwxr-xr-x@ 3 joe staff 102 Jul 23 2009 build</div><div>drwxr-xr-x@ 19 joe staff 646 Jul 23 2009 m4</div><div>drwxr-xr-x@ 4 joe staff 136 Jul 23 2009 package</div>
<div>drwxr-xr-x@ 5 joe staff 170 Jul 23 2009 revision</div><div>drwxr-xr-x@ 9 joe staff 306 Jul 23 2009 sh</div><div>lrwxr-xr-x 1 joe staff 2 Oct 16 2011 share -> ..</div><div>drwxr-xr-x@ 7 joe staff 238 Jul 23 2009 template</div>
</div><div><br></div><div>So share is a link to '..' </div><div><br></div><div>But file:read_file_info thinks 'share' is a directory</div><div><br></div><div><br></div><div>-module(bug).</div><div>-compile(export_all).</div>
<div><br></div><div>-include_lib("kernel/include/file.hrl").</div><div><br></div><div>test() -></div><div> {ok, X} = file:read_file_info("/Users/joe/projects/fuse/fuserl-2.0.5/fw/share"),</div><div>
X#file_info.type.</div><div><br></div><div>Running this</div><div><br></div><div>> bug:test()</div><div>directory.</div><div><br></div><div>I'd expected this to return symlink</div><div><br></div><div>This is on a macbook OS X 10.8.3</div>
<div><br></div><div>Is this a bug, or have I misunderstood something</div></blockquote><div><br></div><div style>I believe file:read_file_info/1,2 will "follow" symlinks and give you information</div><div style>
about whatever the link is pointing to. To get information about the link itself</div><div style>use file:read_link_info/1,2 instead. Despite the name, that function will also</div><div style>work on non-links, in which case you get the same information as</div>
<div style>file:read_file_info/1,2</div><div style><br></div><div style> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div>Cheers</div><span><font color="#888888"><div>
<br></div><div>/Joe</div><div><br></div><div><br></div>
</font></span><br>_______________________________________________<br>
erlang-questions mailing list<br>
<a href="mailto:erlang-questions@erlang.org" target="_blank">erlang-questions@erlang.org</a><br>
<a href="http://erlang.org/mailman/listinfo/erlang-questions" target="_blank">http://erlang.org/mailman/listinfo/erlang-questions</a><br>
<br></blockquote></div><br><br clear="all"><div><br></div>-- <br>--Dave Peticolas
</div></div>