I notice that you use the old OS 8/9 style path URL format, which uses : instead of /. I don’t think this is a good idea. I know most of the Carbon API uses this older format, but that doesn’t mean you should change FMOD because of it. It is simple to convert from a Carbon style pathname to a Unix style pathname. You can convert the unix style pathname to a carbon style pathname before sending it to the carbon api’s. This would be the simplest option. Alternatively, you can load an FSRef from a Unix style pathname and convert it to an FSSpec.
WolverineSoft Project Coordinator
Ah, you’re correct. CFM apps use a : convention while Mach-O apps use the standard /. However, I have a related question about pathnames in the Mach-O version of FMOD. If I create a project in Project Builder using just FMOD and the console, the pathnames FSOUND_Sample_Load uses will be relative to the Build folder if run inside Project Builder (ie, if I send “mysound.mp3” as the pathname, it will look for “mysound.mp3” in the Build folder). If FMOD apps are run on their own, either from the console or by double clicking the bundled apps in the finder, the pathnames FSOUND_Sample_Load uses are relative to the root level of the hard drive, so I would have to call FSOUND_Sample_Load with “/Users/jeremy/Programming/Projects/FMODSimple/Build/FMODSimple.app/Contents/Resources/mySound.mp3” to find the right file. On top of that, the function FSOUND_Sample_Load seems to set this location itself, directly or indirectly, so that it isn’t possible to change where FSOUND_Sample_Load looks for sound files using CoreFoundation calls.
Actually, double clicking a Mac app does indeed do a chdir(“/”). Very unnerving, but well. You can find the directory the app started in using the bundle directory, see the code below.
Starting an exe from the console just leaves the current directory as it is, so it can find relative located files (gcc-style). I’m not sure exactly what ‘open test.app’ (from the console) uses; either the current directory, or the test.app/ directory.
Anyway, below is what I use to move back to the directory where me app should be when doubleclicked. Perhaps it helps.
// Retrieve our bundle
qerr(“Can’t find main bundle.\n”);
qerr(“Can’t copy main bundle URL.\n”);
qerr(“Can’t get system path for bundle.\n”);
- Mentos answered 16 years ago
Please login first to submit.