On Apr 23, 2009, at 3:40 PM, <martin.peach@sympatico.ca> wrote:

IOhannes wrote:
> Martin Peach wrote:
> > 
> > Have a look at the source for [mrpeach/which] in svn. I took some code 
> > from Pd internals and it calls some more, but maybe not _way_ too much.
> > 
> 
> thanks for the hints, but this is even more "ugly" (no harm intended) 
> than what i already have. i really want to be agnostic about which 
> extension the library has (just image miller adds a new extension; or 
> hans removes .l_i386 from PdX and i will actually find the wrong binary)
> 

Well it's the same 'ugly' code that Pd itself uses. I simply copied the extension list from Pd source. I guess you could just access the list directly and then not worry about it changing in the future. The code for [which] tries all possible extensions for the current OS and opens the first one that exists. Pd does the same thing, or at least the version in svn does. Probably if the relevant functions were exposed in m_pd.h they could all be used in situ.

Just an FYI, I tried using [which] on Mac OS X and got this:

/Users/hans/code/pure-data/trunk/externals/mrpeach/which/which.pd_darwin: dlopen(/Users/hans/code/pure-data/trunk/externals/mrpeach/which/which.pd_darwin, 10): Symbol not found: _filelength

_filelength() looks like a Microsoft function.


.hc




Martin
_______________________________________________
Pd-dev mailing list
Pd-dev@iem.at
http://lists.puredata.info/listinfo/pd-dev



----------------------------------------------------------------------------

The arc of history bends towards justice.     - Dr. Martin Luther King, Jr.