From 172ee3d7dc40469b166c8ce7140d78619cd8916c Mon Sep 17 00:00:00 2001 From: Stephen Birarda Date: Thu, 2 Oct 2014 09:06:29 -0700 Subject: [PATCH 1/2] add failsafe for hydra load, look in app frameworks folder --- interface/CMakeLists.txt | 2 ++ interface/src/devices/SixenseManager.cpp | 24 +++++++++++++++++++----- 2 files changed, 21 insertions(+), 5 deletions(-) diff --git a/interface/CMakeLists.txt b/interface/CMakeLists.txt index ddc034801b..5af8bcdd6b 100644 --- a/interface/CMakeLists.txt +++ b/interface/CMakeLists.txt @@ -139,6 +139,8 @@ foreach(EXTERNAL ${OPTIONAL_EXTERNALS}) if (NOT APPLE OR NOT ${${EXTERNAL}_UPPERCASE} MATCHES "SIXENSE") target_link_libraries(${TARGET_NAME} ${${${EXTERNAL}_UPPERCASE}_LIBRARIES}) + elseif (APPLE) + add_definitions(-DSIXENSE_LIB_FILENAME=\"${${${EXTERNAL}_UPPERCASE}_LIBRARY_RELEASE}\") endif () endif () endforeach() diff --git a/interface/src/devices/SixenseManager.cpp b/interface/src/devices/SixenseManager.cpp index c3d694d06c..5fe2b9969c 100644 --- a/interface/src/devices/SixenseManager.cpp +++ b/interface/src/devices/SixenseManager.cpp @@ -96,15 +96,29 @@ void SixenseManager::initialize() { #ifdef __APPLE__ if (!_sixenseLibrary) { - const QString SIXENSE_LIBRARY_NAME = "libsixense_x64.dylib"; - _sixenseLibrary = new QLibrary(SIXENSE_LIBRARY_NAME); + + +#ifdef SIXENSE_LIB_FILENAME + _sixenseLibrary = new QLibrary(SIXENSE_LIB_FILENAME); +#else + const QString SIXENSE_LIBRARY_NAME = "libsixense_x64"; + QFileInfo frameworkSixenseLibrary = QCoreApplication::applicationDirPath() + "../Frameworks/" + + SIXENSE_LIBRARY_NAME; + + _sixenseLibrary = new QLibrary(frameworkSixenseLibrary.fileName()); +#endif + } + + if (_sixenseLibrary->load()){ + qDebug() << "Loaded sixense library for hydra support -" << _sixenseLibrary->fileName(); + } else { + qDebug() << "Sixense library at" << _sixenseLibrary->fileName() << "failed to load." + << "Continuing without hydra support."; + return; } - qDebug() << "Initializing sixense library for hydra support - libsixense_x64.dylib load state is" - << _sixenseLibrary->isLoaded(); SixenseBaseFunction sixenseInit = (SixenseBaseFunction) _sixenseLibrary->resolve("sixenseInit"); #endif - sixenseInit(); _isInitialized = true; From b6e0b08a29836aa1847051fc346abb26efd2e3ab Mon Sep 17 00:00:00 2001 From: Stephen Birarda Date: Thu, 2 Oct 2014 10:07:02 -0700 Subject: [PATCH 2/2] add debug to domain server if script not saved --- domain-server/src/DomainServer.cpp | 25 +++++++++++++++---------- 1 file changed, 15 insertions(+), 10 deletions(-) diff --git a/domain-server/src/DomainServer.cpp b/domain-server/src/DomainServer.cpp index 639d32c823..8f93c7a13e 100644 --- a/domain-server/src/DomainServer.cpp +++ b/domain-server/src/DomainServer.cpp @@ -1261,16 +1261,21 @@ bool DomainServer::handleHTTPRequest(HTTPConnection* connection, const QUrl& url // create a file with the GUID of the assignment in the script host location QFile scriptFile(newPath); - scriptFile.open(QIODevice::WriteOnly); - scriptFile.write(formData[0].second); - - qDebug() << qPrintable(QString("Saved a script for assignment at %1%2") - .arg(newPath).arg(assignmentPool == emptyPool ? "" : " - pool is " + assignmentPool)); - - // add the script assigment to the assignment queue - SharedAssignmentPointer sharedScriptedAssignment(scriptAssignment); - _unfulfilledAssignments.enqueue(sharedScriptedAssignment); - _allAssignments.insert(sharedScriptedAssignment->getUUID(), sharedScriptedAssignment); + if (scriptFile.open(QIODevice::WriteOnly)) { + scriptFile.write(formData[0].second); + + qDebug() << qPrintable(QString("Saved a script for assignment at %1%2") + .arg(newPath).arg(assignmentPool == emptyPool ? "" : " - pool is " + assignmentPool)); + + // add the script assigment to the assignment queue + SharedAssignmentPointer sharedScriptedAssignment(scriptAssignment); + _unfulfilledAssignments.enqueue(sharedScriptedAssignment); + _allAssignments.insert(sharedScriptedAssignment->getUUID(), sharedScriptedAssignment); + } else { + // unable to save script for assignment - we shouldn't be here but debug it out + qDebug() << "Unable to save a script for assignment at" << newPath; + qDebug() << "Script will not be added to queue"; + } } // respond with a 200 code for successful upload