<?xml version="1.0"?>
<rss version="2.0">
	<channel>
		<title>How to manipulate directories ?</title>
		<link>http://www.allegro.cc/forums/view/553531</link>
		<description>Allegro.cc Forum Thread</description>
		<webMaster>matthew@allegro.cc (Matthew Leverton)</webMaster>
		<lastBuildDate>Wed, 21 Dec 2005 03:56:14 +0000</lastBuildDate>
	</channel>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Hi everyone,<br />I would like to know how to create, test if exists, and delete a Directory.</p><p>Wich is the include .h to use ? Can you post to me some examples ?</p><p>Thank you.</p><p>ciao:P
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (LordHolNapul)</author>
		<pubDate>Sat, 17 Dec 2005 20:23:38 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>You can do this with allegro routines, or use the libc equivalents. Remember that a directory is basically a file with the directory flag set (only you cannot read from it or write to it).<br />For allegro routines, this means that you need to add FA_DIREC in the appropriate places. RTFM for more info; look into &quot;File and compression routines&quot;.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Tobias Dammers)</author>
		<pubDate>Sat, 17 Dec 2005 20:38:12 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>My code for those tasks:</p><div class="source-code"><div class="toolbar"></div><div class="inner"><table width="100%"><tbody><tr><td class="number">1</td><td><span class="p">#ifndef ALLEGRO_WINDOWS</span></td></tr><tr><td class="number">2</td><td><span class="p">#include &lt;sys/stat.h&gt;</span></td></tr><tr><td class="number">3</td><td><span class="p">#endif</span></td></tr><tr><td class="number">4</td><td>&#160;</td></tr><tr><td class="number">5</td><td><span class="k1">bool</span> als::create_directory<span class="k2">(</span><span class="k1">const</span> string<span class="k3">&amp;</span> directory<span class="k2">)</span></td></tr><tr><td class="number">6</td><td><span class="k2">{</span></td></tr><tr><td class="number">7</td><td><span class="p">#ifdef ALLEGRO_WINDOWS</span></td></tr><tr><td class="number">8</td><td>  <span class="k1">return</span> CreateDirectory<span class="k2">(</span>directory.c_str<span class="k2">(</span><span class="k2">)</span>, NULL<span class="k2">)</span><span class="k2">;</span></td></tr><tr><td class="number">9</td><td><span class="p">#else</span></td></tr><tr><td class="number">10</td><td>  <span class="k1">return</span> <a href="http://www.delorie.com/djgpp/doc/libc/libc_570.html" target="_blank">mkdir</a><span class="k2">(</span>directory.c_str<span class="k2">(</span><span class="k2">)</span>, S_IRWXU <span class="k3">|</span></td></tr><tr><td class="number">11</td><td>         S_IRGRP <span class="k3">|</span> S_IXGRP <span class="k3">|</span></td></tr><tr><td class="number">12</td><td>         S_IROTH <span class="k3">|</span> S_IXOTH<span class="k2">)</span><span class="k2">;</span></td></tr><tr><td class="number">13</td><td><span class="p">#endif</span></td></tr><tr><td class="number">14</td><td><span class="k2">}</span>  </td></tr><tr><td class="number">15</td><td>&#160;</td></tr><tr><td class="number">16</td><td><span class="k1">bool</span> als::directory_exists<span class="k2">(</span><span class="k1">const</span> string<span class="k3">&amp;</span> <a href="http://www.delorie.com/djgpp/doc/libc/libc_132.html" target="_blank">dirname</a><span class="k2">)</span></td></tr><tr><td class="number">17</td><td><span class="k2">{</span></td></tr><tr><td class="number">18</td><td>  <span class="k1">if</span> <span class="k2">(</span><a href="http://www.allegro.cc/manual/file_exists" target="_blank"><span class="a">file_exists</span></a><span class="k2">(</span>dirname.c_str<span class="k2">(</span><span class="k2">)</span>, FA_DIREC, NULL<span class="k2">)</span><span class="k2">)</span></td></tr><tr><td class="number">19</td><td>    <span class="k1">return</span> <span class="k1">true</span><span class="k2">;</span></td></tr><tr><td class="number">20</td><td>  <span class="k1">return</span> <span class="k1">false</span><span class="k2">;</span></td></tr><tr><td class="number">21</td><td><span class="k2">}</span></td></tr></tbody></table></div></div><p>
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Michael Faerber)</author>
		<pubDate>Sun, 18 Dec 2005 03:20:51 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Thank you, in this case I haven&#39;t Allegro opened and I want to manage directories..</p><p>So you say that the library to manage this is &quot;#include &lt;sys/stat.h&gt;&quot; .</p><p>I hope this is a standard library and I&#39;ll try later.... <img src="http://www.allegro.cc/forums/smileys/smiley.gif" alt=":)" /></p><p>ciao<br /><img src="http://www.allegro.cc/forums/smileys/cool.gif" alt="8-)" />
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (LordHolNapul)</author>
		<pubDate>Sun, 18 Dec 2005 21:05:28 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>It&#39;s not a lib, but a header. But anyway, libc (which either (windows) links statically or (linux) can be assumed to be on the target system) should have appropriate calls too. Otherwise you might want to use the respective platform&#39;s native file system api.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Tobias Dammers)</author>
		<pubDate>Sun, 18 Dec 2005 22:05:13 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Not ANSI, but POSIX:</p><p><span class="source-code"><a href="http://www.delorie.com/djgpp/doc/libc/libc_602.html" target="_blank">opendir</a></span>
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (ReyBrujo)</author>
		<pubDate>Sun, 18 Dec 2005 22:09:19 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>I&#39;ve found that you don&#39;t understood my problem... but you put me to the right way...<br />What I was looking for was , finally, the <span class="source-code"> <span class="p">#include &lt;direct.h&gt; </span></span> that can be manipulated to manage directories....</p><p>I&#39;ve found only this old document that specify a maximum dir lenght of 64 bytes included \0, but it&#39;s not true. I&#39;ve tried the code with 200 byte directory and it works fine...</p><p>here the link if you are interested :</p><p><a> http://www.digitalmars.com/rtl/direct.html#_chdir </a></p><p>see you next time! We will speak of Open Layer <img src="http://www.allegro.cc/forums/smileys/wink.gif" alt=";)" />
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (LordHolNapul)</author>
		<pubDate>Wed, 21 Dec 2005 03:56:14 +0000</pubDate>
	</item>
</rss>
