diff Resources/GenerateErrorCodes.py @ 1734:e2675b37eb01

Under Windows, the exit status of Orthanc corresponds to the encountered error code
author Sebastien Jodogne <s.jodogne@gmail.com>
date Wed, 21 Oct 2015 14:28:57 +0200
parents e1f5ab395297
children b1291df2f780
line wrap: on
line diff
--- a/Resources/GenerateErrorCodes.py	Wed Oct 21 14:10:55 2015 +0200
+++ b/Resources/GenerateErrorCodes.py	Wed Oct 21 14:28:57 2015 +0200
@@ -152,9 +152,8 @@
 with open(path, 'r') as f:
     a = f.read()
 
-s = '\n'.join(map(lambda x: '    PrintError(%d, "%s");' % (x['Code'], x['Name']), ERRORS))
+s = '\n'.join(map(lambda x: '    PrintErrorCode(ErrorCode_%s, "%s");' % (x['Name'], x['Description']), ERRORS))
+a = re.sub('(static void PrintErrors[^{}]*?{[^{}]*?{)([^}]*?)}', r'\1\n%s\n  }' % s, a, re.DOTALL)
 
-print s
-
-#with open(path, 'w') as f:
-#    f.write(a)
+with open(path, 'w') as f:
+    f.write(a)