diff --git a/src/Core/detProcess.hpp b/src/Core/detProcess.hpp index 1b1cffc..a60ce2d 100644 --- a/src/Core/detProcess.hpp +++ b/src/Core/detProcess.hpp @@ -120,7 +120,10 @@ public: if (res1 == true && res2 == true && res3 == true) { emit bridge->loadingWindow_appendInitLog("初始化Mission中...", "yellow"); - _missionLoader.loadMission(missionJson["missionDllPath"]); + bool res = _missionLoader.loadMission(missionJson["missionDllPath"]); + if (res == false) { + emit bridge->loadingWindow_appendInitLog("初始化Mission失败!请检查路径是否正确.", "red"); + } _missionLoader.getmission(missionJson["missionDllPath"])->initBasic( &_serviceManager, missionJson["missionSettings"], bridge diff --git a/src/core/back/missionLoader.h b/src/core/back/missionLoader.h index 256996b..0ee58e5 100644 --- a/src/core/back/missionLoader.h +++ b/src/core/back/missionLoader.h @@ -7,7 +7,7 @@ class MissionLoader { bool loadMission(const std::string& missionPath) { hDlls[missionPath] = LoadLibrary(missionPath.c_str()); if (!hDlls[missionPath]) { - std::cerr << "Failed to load DLL!" << std::endl; + std::cerr << "Failed to load Misson DLL!" << std::endl; return false; } createMissionFunc createMission = (createMissionFunc)GetProcAddress(hDlls[missionPath], "createMission"); @@ -17,7 +17,7 @@ class MissionLoader { missionMap[missionPath] = createMission(); } else { - std::cerr << "Failed to get function pointers!" << std::endl; + std::cerr << "Failed to get Misson function pointers!" << std::endl; return false; } return true; diff --git a/src/launcher/appConfig/appConfig.cpp b/src/launcher/appConfig/appConfig.cpp index 6ccfe95..e15c88f 100644 --- a/src/launcher/appConfig/appConfig.cpp +++ b/src/launcher/appConfig/appConfig.cpp @@ -16,6 +16,11 @@ void appConfig::parsingSettingJson() loginPassWord = settingJson["loginPassWord"]; missionJson = readOrderedJsonFromPath(appWorkPath.string() + "/config/" + objectSelect +".json"); + if(QFile(QString::fromStdString(missionJson)).exists() == false){ + std::cout << "Mission config file not found: " << (appWorkPath.string() + "/config/" + objectSelect +".json") << std::endl; + std::cout << "任务配置文件未找到: " << (appWorkPath.string() + "/config/" + objectSelect +".json") << std::endl; + exit(1); + } softwareTile = missionJson["softwareTile"]; imgSavePath = missionJson["backend"]["imgSaveBasePath"]; //viewer diff --git a/src/launcher/appCore.hpp b/src/launcher/appCore.hpp index 115522a..7894b7c 100644 --- a/src/launcher/appCore.hpp +++ b/src/launcher/appCore.hpp @@ -20,8 +20,8 @@ public: json = jsonIn; hDll = LoadLibrary("core.dll"); if (!hDll) { - std::cerr << "Failed to load DLL!" << std::endl; - return false; + std::cerr << "Failed to load Core DLL!" << std::endl; + exit(1); } CreateBackend = (CreateBackendFunc)GetProcAddress(hDll, "CreateBackend"); @@ -31,8 +31,8 @@ public: backend = CreateBackend(); } else { - std::cerr << "Failed to get function pointers!" << std::endl; - return false; + std::cerr << "Failed to get Core function pointers!" << std::endl; + exit(1); } backend->init(db,bridgeIn, jsonIn); return true;