So I’m building an application, and I need to include a bunch of small (<4kb) audio files in it. Including the folder containing all the files, and including them one at a time, does not work. The only way the built app recognizes them is if they're in the same folder as the app itself, which is... messy.
Whenever I put the app on another computer, without the audio files, I get a ‘buffer~: can’t read’ error.
There’s a thread about this every couple weeks. Max can only find files in the same directory, or in the search path. I suggest you add your samples folder (which is relative i suppose) to the search path when loading the patch. Use the [filepath] object for this.
Ah, I must have phrased it badly – I’ve got it working quite fine in MaxMSP 5, adding new filepaths is oldschool. The problem is when I try to build it into an application, and tell the build script to include the folder of samples, it just… doesn’t. The application (which I’d like to be fully self contained) has to be sitting in a mess of sample files, because if I send it to someone that doesn’t have a full Max5 install, they can’t very well change their file search paths.
OK, here’s what I had to do: I’ve got all these sample files – instead of putting them in the same folder as the application, open the application as a package (in OSX, ctrl-click and select ‘Show Package Contents.’
From there, go to Contents: MacOS, and drop your files inside that folder.
Your standalone application will now run fine, loading your files when necessary, while staying completely self-contained!
Ah, i indeed got you wrong there…
Smart solution (although personally i think the Mac package system is not very intuitive, i didn’t know there were folders behind everything at first). But in this case, it works fine.