Re: [AD] standard path updates

[ Thread Index | Date Index | More lists.liballeg.org/allegro-developers Archives ]


On 1 Mar 2011, at 0:14 , Matthew Leverton wrote:
> The programmer would have to call that function:
> 
> #ifdef LINUX
> al_set_resource_directory(DIR_FROM_CONFIGURE);
> #endif
> 
> #ifdef WINDOWS
> al_set_resource_directory("c:/programdata/myapp/");
> #endif

The problem is this: hard-coding the path like that on Windows disregards operating system localisation. Handling that properly requires Windows-specific code beyond simply changing the name of the directory conditionally at compile time. This is something that Allegro /could/ make easier by having a query function for it (with the usual caveats).

That said, I do think TF has a point, but it needs to be very clearly defined how a function like that would work reliably and what it can and cannot do across platforms. Simply having a function that returns a particular path, depending on the OS, is not good enough. It would first need to be discussed and agreed upon what the correct behaviour should be on all platforms.

Related question: on Linux, does asking for the resource path resolve symbolic links in the path? So if binary and data live in /some/path/somewhere/myapp and myapp is symlinked in /usr/local/bin/myapp->/some/path/somewhere/myapp, does the resource path give you /some/path/somewhere? If it does, then that partly solves the problem.

Evert



Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/