Update Ghoul repository (closes #483)

Do not let exception leak out of OpenSpaceEngine::create method
Add double dash to long name commandline arguments
This commit is contained in:
Alexander Bock
2018-02-06 11:34:42 -05:00
parent ccce1bcacb
commit 8551d6799e
3 changed files with 37 additions and 12 deletions

View File

@@ -506,12 +506,36 @@ int main_main(int argc, char** argv) {
// @CLEANUP: Replace the return valua with throwing an exception --abock
std::vector<std::string> sgctArguments;
bool requestQuit = false;
openspace::OpenSpaceEngine::create(
argc, argv,
std::make_unique<openspace::SGCTWindowWrapper>(),
sgctArguments,
requestQuit
);
try {
openspace::OpenSpaceEngine::create(
argc, argv,
std::make_unique<openspace::SGCTWindowWrapper>(),
sgctArguments,
requestQuit
);
}
catch (const ghoul::RuntimeError& e) {
// Write out all of the information about the exception and flush the logs
LFATALC(e.component, e.message);
LogMgr.flushLogs();
return EXIT_FAILURE;
}
catch (const ghoul::AssertionException& e) {
// We don't want to catch the assertion exception as we won't be able to add a
// breakpoint for debugging
LFATALC("Assertion failed", e.what());
throw;
}
catch (const std::exception& e) {
LFATALC("Exception", e.what());
LogMgr.flushLogs();
return EXIT_FAILURE;
}
catch (...) {
LFATALC("Exception", "Unknown exception");
LogMgr.flushLogs();
return EXIT_FAILURE;
}
if (requestQuit) {
return EXIT_SUCCESS;

View File

@@ -312,7 +312,7 @@ void OpenSpaceEngine::create(int argc, char** argv,
if (!FileSys.fileExists(configurationFilePath)) {
throw ghoul::FileNotFoundError(
"Configuration file '" + configurationFilePath + "' not found"
"Configuration file '" + configurationFilePath + "'"
);
}
LINFO("Configuration Path: '" << configurationFilePath << "'");
@@ -821,26 +821,26 @@ void OpenSpaceEngine::writeStaticDocumentation() {
void OpenSpaceEngine::gatherCommandlineArguments() {
commandlineArgumentPlaceholders.configurationName = "";
_commandlineParser->addCommand(std::make_unique<SingleCommand<std::string>>(
commandlineArgumentPlaceholders.configurationName, "-config", "-c",
commandlineArgumentPlaceholders.configurationName, "--config", "-c",
"Provides the path to the OpenSpace configuration file"
));
commandlineArgumentPlaceholders.sgctConfigurationName = "";
_commandlineParser->addCommand(std::make_unique<SingleCommand<std::string>>(
commandlineArgumentPlaceholders.sgctConfigurationName, "-sgct", "-s",
commandlineArgumentPlaceholders.sgctConfigurationName, "--sgct", "-s",
"Provides the path to the SGCT configuration file, overriding the value set in "
"the OpenSpace configuration file"
));
commandlineArgumentPlaceholders.sceneName = "";
_commandlineParser->addCommand(std::make_unique<SingleCommand<std::string>>(
commandlineArgumentPlaceholders.sceneName, "-scene", "", "Provides the path to "
commandlineArgumentPlaceholders.sceneName, "--scene", "", "Provides the path to "
"the scene file, overriding the value set in the OpenSpace configuration file"
));
commandlineArgumentPlaceholders.cacheFolder = "";
_commandlineParser->addCommand(std::make_unique<SingleCommand<std::string>>(
commandlineArgumentPlaceholders.cacheFolder, "-cacheDir", "", "Provides the "
commandlineArgumentPlaceholders.cacheFolder, "--cacheDir", "", "Provides the "
"path to a cache file, overriding the value set in the OpenSpace configuration "
"file"
));
@@ -1231,6 +1231,7 @@ void OpenSpaceEngine::preSynchronization() {
FileSys.triggerFilesystemEvents();
if (_hasScheduledAssetLoading) {
LINFO("Loading asset: " << _scheduledAssetPathToLoad);
loadSingleAsset(_scheduledAssetPathToLoad);
_hasScheduledAssetLoading = false;
_scheduledAssetPathToLoad = "";