<?xml version="1.0"?>
<rss version="2.0">
	<channel>
		<title>[A5] al_read_directory() odd behavior</title>
		<link>http://www.allegro.cc/forums/view/616495</link>
		<description>Allegro.cc Forum Thread</description>
		<webMaster>matthew@allegro.cc (Matthew Leverton)</webMaster>
		<lastBuildDate>Mon, 26 Sep 2016 21:31:09 +0000</lastBuildDate>
	</channel>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>So what I&#39;m doing is this. I create an FS_ENTRY with a path to my lib folder, then open the directory and try to read the files inside. I&#39;ve confirmed that the FS_ENTRY exists and is a valid path, and when I try to read the files in the directory, it is able to create a not-null FS_ENTRY for all objects in the directory. The problem is that the path for each of these FS_ENTRY objects is &quot;C:\...\lib\&quot; and al_fs_entry_exists() returns false for all of them.</p><div class="source-code"><div class="toolbar"><span class="button numbers"><b>#</b></span><span class="button select">Select</span><span class="button expand">Expand</span></div><div class="inner"><span class="number">  1</span><span class="c">// created a FS_ENTRY* dir with a path to lib folder</span>
<span class="number">  2</span>
<span class="number">  3</span><span class="k1">if</span> <span class="k2">(</span><a href="http://www.allegro.cc/manual/al_get_fs_entry_mode"><span class="a">al_get_fs_entry_mode</span></a><span class="k2">(</span>dir<span class="k2">)</span> <span class="k3">&amp;</span> ALLEGRO_FILEMODE_ISDIR<span class="k2">)</span> <span class="k2">{</span>
<span class="number">  4</span>
<span class="number">  5</span>    <span class="k1">if</span> <span class="k2">(</span><a href="http://www.allegro.cc/manual/al_open_directory"><span class="a">al_open_directory</span></a><span class="k2">(</span>dir<span class="k2">)</span><span class="k2">)</span> <span class="k2">{</span>
<span class="number">  6</span>
<span class="number">  7</span>        <a href="http://www.allegro.cc/manual/ALLEGRO_FS_ENTRY"><span class="a">ALLEGRO_FS_ENTRY</span></a><span class="k3">*</span> file<span class="k2">;</span>
<span class="number">  8</span>        <span class="k1">while</span> <span class="k2">(</span>file <span class="k3">=</span> <a href="http://www.allegro.cc/manual/al_read_directory"><span class="a">al_read_directory</span></a><span class="k2">(</span>dir<span class="k2">)</span><span class="k2">)</span> <span class="k2">{</span>
<span class="number">  9</span>
<span class="number"> 10</span>            <span class="k1">if</span> <span class="k2">(</span><a href="http://www.allegro.cc/manual/al_fs_entry_exists"><span class="a">al_fs_entry_exists</span></a><span class="k2">(</span>file<span class="k2">)</span><span class="k2">)</span> <span class="k2">{</span>
<span class="number"> 11</span>
<span class="number"> 12</span>                <span class="c">// execute code</span>
<span class="number"> 13</span>            <span class="k2">}</span>
<span class="number"> 14</span>
<span class="number"> 15</span>            <a href="http://www.allegro.cc/manual/al_destroy_fs_entry"><span class="a">al_destroy_fs_entry</span></a><span class="k2">(</span>file<span class="k2">)</span><span class="k2">;</span>
<span class="number"> 16</span>        <span class="k2">}</span>
<span class="number"> 17</span>
<span class="number"> 18</span>        <a href="http://www.allegro.cc/manual/al_close_directory"><span class="a">al_close_directory</span></a><span class="k2">(</span>dir<span class="k2">)</span><span class="k2">;</span>
<span class="number"> 19</span>    <span class="k2">}</span>
<span class="number"> 20</span><span class="k2">}</span>
</div></div><p>

I&#39;m compiling this program on Windows 10. I&#39;m not sure if this is an issue with my code or with Allegro -- has anyone else had an issue similar to this, or can at least offer advice?
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (aureneas)</author>
		<pubDate>Sat, 24 Sep 2016 04:58:50 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Hey Aureneas,</p><p>How are you creating your original ALLEGRO_FS_ENTRY? Are you using al_create_fs_entry with a relative or absolute path? It seems to work with relative paths on my system. What is the full directory path to your lib folder? Perhaps there is a limitation on the number of characters in the path.</p><p><a href="https://www.allegro.cc/files/attachment/610566">FSentry.cpp</a><br /><a href="https://www.allegro.cc/files/attachment/610568">list.exe</a> (statically linked directory listing program) <br />(Use with a directory as argument or with no argument the current directory is used).</p><p>I had this old test program lying around and I ran it on my Windows 10 machine after rebuilding it with MinGW 5.3.0-2 and Allegro 5.2.1.1 and it seems to list directory contents just fine. Give it a try and see if it works for you. If so, maybe there is some code difference? Are you compiling with MinGW or MSVC? Or Clang or Borland maybe?</p><div class="source-code snippet"><div class="inner"><pre>
</pre></div></div><p>
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Edgar Reynaldo)</author>
		<pubDate>Sun, 25 Sep 2016 01:51:45 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Hmm... list.exe seems to work fine, but when I compiled FSentry.cpp with a full directory path of &quot;C:\Programs\test&quot; it produced the same result as before. So I suppose it&#39;s not an issue with code, but an issue with the way my machine is compiling it?</p><p>My compiler is MinGW 5.3.0, with Allegro 5.0.10 (my version came bundled with MinGW 4.7.0), and I&#39;m statically linking to the Allegro library in Code::Blocks. Do you upgrading to 5.2.1.1 would fix the problem, or do you think the issue is something else?
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (aureneas)</author>
		<pubDate>Mon, 26 Sep 2016 12:25:04 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>It&#39;s probably a library version problem. Also, you shouldn&#39;t mix binaries of Allegro for MinGW 4.7 with MinGW 5.3. The version of MinGW used needs to match.</p><p>Yes, you should upgrade. 5.0.10 is pretty old. I have binaries for MinGW 5.3.0-2 and Allegro 5.2.1.1 here :</p><p><a href="https://www.allegro.cc/forums/thread/616446">https://www.allegro.cc/forums/thread/616446</a>
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Edgar Reynaldo)</author>
		<pubDate>Mon, 26 Sep 2016 21:31:09 +0000</pubDate>
	</item>
</rss>
