Where to put supporting file?

Jul 28, 2009 at 6:43pm

Where to put supporting file?

Quick question, so my external depends on a 3rd party dylib file but the dylib looks for the file isports.ini either in /dev or in the directory that the application is running in. Problem is that when it’s compiled as an external I don’t know where to put the .ini file. Doesn’t seem to work when included in the MXO as contents/resources, in the Max5 folder, in the same directory as the .mxo builds to. Am I missing something obvious?

Oh, and I can’t sudo cp the file to the /dev directory so I don’t think that’s an option.

Any suggestions?

#44925
Jul 28, 2009 at 6:57pm

Is this an external you are building? If so, you can use the max/msp “nameinpath()” and “path_topathname()” functions to find the file somewhere on the max search path.

If not, I think there are some shell variables you can set (like $LIBS or something) that may work, but not sure if max/msp will pay heed to them.

brad
http://music.columbia.edu/~brad

#161773
Jul 29, 2009 at 9:01am

Not sure. Have you tried Contents/MacOS/ ? That’s where your external’s executable is.

My first guess would have been the Max5/ directory, but you said that didn’t work.

#161774
Jul 29, 2009 at 12:43pm

Thanks so much for the replies!

I did also try in the MACOS/ directory, but now I’m starting to think that maybe I had multiple files which confuses (what I’m assuming is) the fopen command. So I might have to go through things methodically, painstakingly, moving the file around.

I also appealed to the developer who sent me a new dylib which may allow me to set the path internally, but it’s not foolproof, so I might have to try doing it manually anyhow.

Will post a solution if/when that happens. All suggestions are still welcome!!

#161775
Jul 29, 2009 at 3:56pm

Max’s searchpath does not drill down into bundles. If it did then the searchpath would become gigantic and performance would suffer. So…

You can first determine the path of your mxo bundle (the extern) using Max’s API. Then you can use Apple’s functions for finding the folders (e.g. the Resources folder) inside your bundle (or just append the path using the CFURL API or whatever it is you need to do).

Hope that helps.

#161776
Aug 2, 2009 at 9:30pm

Ultimately the developer of the .dylib changed the behaviour to check the PATH first so by using:
$export ISPORTS_INI_DIR=/
and keeping the ini file in the / dir all is well.

Wish I had a more elequent solution but doubtful many people are going to use this external when it’s done anyways.

#161777

You must be logged in to reply to this topic.