mirror of
https://github.com/overte-org/overte.git
synced 2025-08-04 05:43:36 +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
|
// read the walking sound from the raw file and store it
|
||||||
// in the in memory array
|
// in the in memory array
|
||||||
|
|
||||||
switchToResourcesIfRequired();
|
switchToResourcesParentIfRequired();
|
||||||
FILE *soundFile = fopen("audio/walking.raw", "r");
|
FILE *soundFile = fopen("resources/audio/walking.raw", "r");
|
||||||
|
|
||||||
// get length of file:
|
// get length of file:
|
||||||
std::fseek(soundFile, 0, SEEK_END);
|
std::fseek(soundFile, 0, SEEK_END);
|
||||||
|
|
|
@ -114,7 +114,7 @@ Head::Head() {
|
||||||
springVelocityDecay = 16.0f;
|
springVelocityDecay = 16.0f;
|
||||||
|
|
||||||
if (iris_texture.size() == 0) {
|
if (iris_texture.size() == 0) {
|
||||||
switchToResourcesIfRequired();
|
switchToResourcesParentIfRequired();
|
||||||
unsigned error = lodepng::decode(iris_texture, iris_texture_width, iris_texture_height, iris_texture_file);
|
unsigned error = lodepng::decode(iris_texture, iris_texture_width, iris_texture_height, iris_texture_file);
|
||||||
if (error != 0) {
|
if (error != 0) {
|
||||||
std::cout << "error " << error << ": " << lodepng_error_text(error) << std::endl;
|
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);
|
return (byte >> (7 - bitIndex) & 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
void switchToResourcesIfRequired() {
|
void switchToResourcesParentIfRequired() {
|
||||||
#ifdef __APPLE__
|
#ifdef __APPLE__
|
||||||
CFBundleRef mainBundle = CFBundleGetMainBundle();
|
CFBundleRef mainBundle = CFBundleGetMainBundle();
|
||||||
CFURLRef resourcesURL = CFBundleCopyResourcesDirectoryURL(mainBundle);
|
CFURLRef resourcesURL = CFBundleCopyResourcesDirectoryURL(mainBundle);
|
||||||
|
@ -85,6 +85,7 @@ void switchToResourcesIfRequired() {
|
||||||
CFRelease(resourcesURL);
|
CFRelease(resourcesURL);
|
||||||
|
|
||||||
chdir(path);
|
chdir(path);
|
||||||
|
chdir("..");
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -47,7 +47,7 @@ void printVoxelCode(unsigned char* voxelCode);
|
||||||
int numberOfOnes(unsigned char byte);
|
int numberOfOnes(unsigned char byte);
|
||||||
bool oneAtBit(unsigned char byte, int bitIndex);
|
bool oneAtBit(unsigned char byte, int bitIndex);
|
||||||
|
|
||||||
void switchToResourcesIfRequired();
|
void switchToResourcesParentIfRequired();
|
||||||
|
|
||||||
const char* getCmdOption(int argc, const char * argv[],const char* option);
|
const char* getCmdOption(int argc, const char * argv[],const char* option);
|
||||||
bool cmdOptionExists(int argc, const char * argv[],const char* option);
|
bool cmdOptionExists(int argc, const char * argv[],const char* option);
|
||||||
|
|
Loading…
Reference in a new issue