add method to SharedUtil to chdir to OS X bundle resources

This commit is contained in:
Stephen Birarda 2013-03-22 10:35:55 -07:00
parent 6712d23cd1
commit 3fa0439f29
3 changed files with 9 additions and 6 deletions

View file

@ -7,4 +7,9 @@ MACRO(LINK_HIFI_SHARED_LIBRARY TARGET)
get_directory_property(HIFI_SHARED_LIBRARY DIRECTORY ../shared DEFINITION HIFI_SHARED_LIBRARY)
add_dependencies(${TARGET} ${HIFI_SHARED_LIBRARY})
target_link_libraries(${TARGET} ${HIFI_SHARED_LIBRARY})
if (APPLE)
# link in required OS X framework
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -framework CoreServices")
endif (APPLE)
ENDMACRO(LINK_HIFI_SHARED_LIBRARY _target)

View file

@ -10,7 +10,7 @@ project(interface)
if (APPLE)
# link in required OS X frameworks and include the right GL headers
set(CMAKE_EXE_LINKER_FLAGS "-framework CoreAudio -framework AudioToolbox -framework AudioUnit -framework CoreServices -framework Carbon -framework GLUT")
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -framework CoreAudio -framework AudioToolbox -framework AudioUnit -framework CoreServices -framework Carbon -framework GLUT")
set(GL_HEADERS "#include <GLUT/glut.h>\n#include <OpenGL/glext.h>")
else (APPLE)
# include the right GL headers for UNIX

View file

@ -66,13 +66,11 @@ void switchToResourcesIfRequired() {
CFBundleRef mainBundle = CFBundleGetMainBundle();
CFURLRef resourcesURL = CFBundleCopyResourcesDirectoryURL(mainBundle);
char path[PATH_MAX];
if (!CFURLGetFileSystemRepresentation(resourcesURL, TRUE, (UInt8 *)path, PATH_MAX)) // Error: expected unqualified-id before 'if'
{
if (!CFURLGetFileSystemRepresentation(resourcesURL, TRUE, (UInt8 *)path, PATH_MAX)) {
// error!
}
CFRelease(resourcesURL); // error: expected constructor, destructor or type conversion before '(' token
CFRelease(resourcesURL);
chdir(path); // error: expected constructor, destructor or type conversion before '(' token
std::cout << "Current Path: " << path << std::endl; // error: expected constructor, destructor or type conversion before '<<' token
chdir(path);
#endif
}