mirror of
https://github.com/JulianGro/overte.git
synced 2025-04-10 04:53:04 +02:00
fix reference to resources directory on OS X
This commit is contained in:
parent
0768785cfd
commit
e9592c45c7
4 changed files with 6 additions and 5 deletions
|
@ -444,8 +444,8 @@ Audio::Audio(Oscilloscope *s, Head *linkedHead)
|
|||
// read the walking sound from the raw file and store it
|
||||
// in the in memory array
|
||||
|
||||
switchToResourcesIfRequired();
|
||||
FILE *soundFile = fopen("audio/walking.raw", "r");
|
||||
switchToResourcesParentIfRequired();
|
||||
FILE *soundFile = fopen("resources/audio/walking.raw", "r");
|
||||
|
||||
// get length of file:
|
||||
std::fseek(soundFile, 0, SEEK_END);
|
||||
|
|
|
@ -114,7 +114,7 @@ Head::Head() {
|
|||
springVelocityDecay = 16.0f;
|
||||
|
||||
if (iris_texture.size() == 0) {
|
||||
switchToResourcesIfRequired();
|
||||
switchToResourcesParentIfRequired();
|
||||
unsigned error = lodepng::decode(iris_texture, iris_texture_width, iris_texture_height, iris_texture_file);
|
||||
if (error != 0) {
|
||||
std::cout << "error " << error << ": " << lodepng_error_text(error) << std::endl;
|
||||
|
|
|
@ -74,7 +74,7 @@ bool oneAtBit(unsigned char byte, int bitIndex) {
|
|||
return (byte >> (7 - bitIndex) & 1);
|
||||
}
|
||||
|
||||
void switchToResourcesIfRequired() {
|
||||
void switchToResourcesParentIfRequired() {
|
||||
#ifdef __APPLE__
|
||||
CFBundleRef mainBundle = CFBundleGetMainBundle();
|
||||
CFURLRef resourcesURL = CFBundleCopyResourcesDirectoryURL(mainBundle);
|
||||
|
@ -85,6 +85,7 @@ void switchToResourcesIfRequired() {
|
|||
CFRelease(resourcesURL);
|
||||
|
||||
chdir(path);
|
||||
chdir("..");
|
||||
#endif
|
||||
}
|
||||
|
||||
|
|
|
@ -47,7 +47,7 @@ void printVoxelCode(unsigned char* voxelCode);
|
|||
int numberOfOnes(unsigned char byte);
|
||||
bool oneAtBit(unsigned char byte, int bitIndex);
|
||||
|
||||
void switchToResourcesIfRequired();
|
||||
void switchToResourcesParentIfRequired();
|
||||
|
||||
const char* getCmdOption(int argc, const char * argv[],const char* option);
|
||||
bool cmdOptionExists(int argc, const char * argv[],const char* option);
|
||||
|
|
Loading…
Reference in a new issue