diff Plugins/Samples/Basic/Plugin.c @ 1040:d06186cdc502

check plugin version in samples
author Sebastien Jodogne <s.jodogne@gmail.com>
date Thu, 17 Jul 2014 13:04:02 +0200
parents 5a5a4890ffca
children 2c49b7dffcec
line wrap: on
line diff
--- a/Plugins/Samples/Basic/Plugin.c	Thu Jul 17 12:46:00 2014 +0200
+++ b/Plugins/Samples/Basic/Plugin.c	Thu Jul 17 13:04:02 2014 +0200
@@ -134,21 +134,21 @@
   char info[1024];
   char *id, *eos;
 
-  char error[256];
+  context = c;
+  OrthancPluginLogWarning(context, "Sample plugin is initializing");
+
+  /* Check the version of the Orthanc core */
   if (OrthancPluginCheckVersion(c) == 0)
   {
-    sprintf(error, "Your version of Orthanc (%s) must be above %d.%d.%d to run this plugin",
+    sprintf(info, "Your version of Orthanc (%s) must be above %d.%d.%d to run this plugin",
             c->orthancVersion,
             ORTHANC_PLUGINS_MINIMAL_MAJOR_NUMBER,
             ORTHANC_PLUGINS_MINIMAL_MINOR_NUMBER,
             ORTHANC_PLUGINS_MINIMAL_REVISION_NUMBER);
-    OrthancPluginLogError(context, error);
+    OrthancPluginLogError(context, info);
     return -1;
   }
 
-  context = c;
-  OrthancPluginLogWarning(context, "Sample plugin is initializing");
-
   sprintf(info, "The version of Orthanc is '%s'", context->orthancVersion);
   OrthancPluginLogInfo(context, info);