<?xml version="1.0"?>
<rss version="2.0">
	<channel>
		<title>The name of the currently used Allegro configuration file.</title>
		<link>http://www.allegro.cc/forums/view/590345</link>
		<description>Allegro.cc Forum Thread</description>
		<webMaster>matthew@allegro.cc (Matthew Leverton)</webMaster>
		<lastBuildDate>Tue, 06 Mar 2007 03:42:04 +0000</lastBuildDate>
	</channel>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>How do I get the name of the currently used Allegro configuration file? I suspect that when my program is ported to some platforms, it is not being read. I usually place it in the same directory as the executable and use the following code to read it.</p><div class="source-code snippet"><div class="inner"><pre><span class="k1">static</span> <span class="k1">void</span>
_chSetINIFile<span class="k2">(</span><span class="k2">)</span>
<span class="k2">{</span>
  <span class="c">// NOTE: This code is called after allegro_init();</span>
  <span class="k1">char</span> szPath<span class="k2">[</span>CHIO_MAXPATHLENGTH<span class="k2">]</span>, szINIFile<span class="k2">[</span>CHIO_MAXPATHLENGTH<span class="k2">]</span><span class="k2">;</span>  
  <a href="http://www.allegro.cc/manual/get_executable_name" target="_blank"><span class="a">get_executable_name</span></a><span class="k2">(</span>szPath, <span class="k1">sizeof</span><span class="k2">(</span>szPath<span class="k2">)</span><span class="k2">)</span><span class="k2">;</span>  
  <a href="http://www.allegro.cc/manual/replace_filename" target="_blank"><span class="a">replace_filename</span></a><span class="k2">(</span>szINIFile, szPath, CHINIFILENAME, CHIO_MAXPATHLENGTH-1<span class="k2">)</span><span class="k2">;</span>  
  <a href="http://www.allegro.cc/manual/override_config_file" target="_blank"><span class="a">override_config_file</span></a><span class="k2">(</span>szINIFile<span class="k2">)</span><span class="k2">;</span>
<span class="k2">}</span>
</pre></div></div><p>

This succeeds on Windows and DOS, but I suspect it&#39;s failing when the app is ported to MacOs X.</p><p>In Allegro&#39;s <tt>config.c</tt>, I suspect the variable that I&#39;m looking for is <tt>config_override</tt>, but it&#39;s declared static and is not exposed in any way. Is there any way to find out if <tt>override_config_file()</tt> succeeded in reading the INI file (it returns void so does not report back on status)?</p><p>AE.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Andrei Ellman)</author>
		<pubDate>Thu, 01 Mar 2007 22:05:56 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>The easy, hackish way is to create a uniquely-named string value and try to read it.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (CGamesPlay)</author>
		<pubDate>Thu, 01 Mar 2007 23:29:04 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>I thought about that, but that seemed too hackish. Ideally, Allegro&#39;s configuration-file reading functions should give some indication as to whether or not  they actually managed to read the file. After browsing the Allegro source, another hackish idea I had was to read the internal struct containing details of the INI filename (by referencing the variable directly and hoping that the linker will sort things out), but this would only work if I compiled a statically-linked binary.</p><p>AE.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Andrei Ellman)</author>
		<pubDate>Tue, 06 Mar 2007 03:42:04 +0000</pubDate>
	</item>
</rss>
