diff Resources/EmbedResources.py @ 4034:78ee0155ec67

trying to use orthanc frameworking with web-viewer plugin
author Sebastien Jodogne <s.jodogne@gmail.com>
date Wed, 10 Jun 2020 10:14:15 +0200
parents 100fbe970762
children
line wrap: on
line diff
--- a/Resources/EmbedResources.py	Tue Jun 09 21:45:54 2020 +0200
+++ b/Resources/EmbedResources.py	Wed Jun 10 10:14:15 2020 +0200
@@ -43,6 +43,7 @@
 OUT_OF_RANGE_EXCEPTION = '::Orthanc::OrthancException(::Orthanc::ErrorCode_ParameterOutOfRange)'
 INEXISTENT_PATH_EXCEPTION = '::Orthanc::OrthancException(::Orthanc::ErrorCode_InexistentItem)'
 NAMESPACE = 'Orthanc.EmbeddedResources'
+FRAMEWORK_PATH = None
 
 ARGS = []
 for i in range(len(sys.argv)):
@@ -57,6 +58,8 @@
         INEXISTENT_PATH_EXCEPTION = '%s("Unknown path in a directory resource")' % EXCEPTION_CLASS
     elif sys.argv[i].startswith('--namespace='):
         NAMESPACE = sys.argv[i][sys.argv[i].find('=') + 1 : ]
+    elif sys.argv[i].startswith('--framework-path='):
+        FRAMEWORK_PATH = sys.argv[i][sys.argv[i].find('=') + 1 : ]
 
 if len(ARGS) < 2 or len(ARGS) % 2 != 0:
     print ('Usage:')
@@ -280,8 +283,10 @@
 
 if USE_SYSTEM_EXCEPTION:
     cpp.write('#include <stdexcept>')
+elif FRAMEWORK_PATH != None:
+    cpp.write('#include "%s/OrthancException.h"' % FRAMEWORK_PATH)
 else:
-    cpp.write('#include "%s/Core/OrthancException.h"' % os.path.abspath(os.path.join(os.path.dirname(__file__), '..')))
+    cpp.write('#include <OrthancException.h>')
 
 cpp.write("""
 #include <stdint.h>