comparison Framework/Plugins/PluginInitialization.cpp @ 490:b3876cbb93a2

Fix check of Orthanc runtime version
author Sebastien Jodogne <s.jodogne@gmail.com>
date Fri, 22 Mar 2024 14:36:38 +0100
parents ecd0b719cff5
children af6998ed73dd
comparison
equal deleted inserted replaced
489:e8b4bb6a33e7 490:b3876cbb93a2
57 ImplicitTransaction::SetErrorOnDoubleExecution(false); 57 ImplicitTransaction::SetErrorOnDoubleExecution(false);
58 58
59 assert(DisplayPerformanceWarning(dbms, isIndex)); 59 assert(DisplayPerformanceWarning(dbms, isIndex));
60 60
61 /* Check the version of the Orthanc core */ 61 /* Check the version of the Orthanc core */
62 if (OrthancPluginCheckVersion(context) == 0)
63 {
64 LOG(ERROR) << "Your version of Orthanc ("
65 << context->orthancVersion << ") must be above "
66 << ORTHANC_PLUGINS_MINIMAL_MAJOR_NUMBER << "."
67 << ORTHANC_PLUGINS_MINIMAL_MINOR_NUMBER << "."
68 << ORTHANC_PLUGINS_MINIMAL_REVISION_NUMBER
69 << " to run this plugin";
70 return false;
71 }
72
73
74 /* Warn the user if the Orthanc runtime has not an optimal version */
62 75
63 bool useFallback = true; 76 bool useFallback = true;
64 bool isOptimal = false; 77 bool isOptimal = false;
65 78
66 #if defined(ORTHANC_PLUGINS_VERSION_IS_ABOVE) // Macro introduced in Orthanc 1.3.1 79 #if defined(ORTHANC_PLUGINS_VERSION_IS_ABOVE) // Macro introduced in Orthanc 1.3.1
86 } 99 }
87 100
88 useFallback = false; 101 useFallback = false;
89 # endif 102 # endif
90 #endif 103 #endif
91
92 if (useFallback &&
93 OrthancPluginCheckVersion(context) == 0)
94 {
95 LOG(ERROR) << "Your version of Orthanc ("
96 << context->orthancVersion << ") must be above "
97 << ORTHANC_PLUGINS_MINIMAL_MAJOR_NUMBER << "."
98 << ORTHANC_PLUGINS_MINIMAL_MINOR_NUMBER << "."
99 << ORTHANC_PLUGINS_MINIMAL_REVISION_NUMBER
100 << " to run this plugin";
101 return false;
102 }
103 104
104 if (useFallback) 105 if (useFallback)
105 { 106 {
106 std::string v(context->orthancVersion); 107 std::string v(context->orthancVersion);
107 108