comparison 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
comparison
equal deleted inserted replaced
1733:e1f5ab395297 1734:e2675b37eb01
150 150
151 path = os.path.join(BASE, 'OrthancServer', 'main.cpp') 151 path = os.path.join(BASE, 'OrthancServer', 'main.cpp')
152 with open(path, 'r') as f: 152 with open(path, 'r') as f:
153 a = f.read() 153 a = f.read()
154 154
155 s = '\n'.join(map(lambda x: ' PrintError(%d, "%s");' % (x['Code'], x['Name']), ERRORS)) 155 s = '\n'.join(map(lambda x: ' PrintErrorCode(ErrorCode_%s, "%s");' % (x['Name'], x['Description']), ERRORS))
156 a = re.sub('(static void PrintErrors[^{}]*?{[^{}]*?{)([^}]*?)}', r'\1\n%s\n }' % s, a, re.DOTALL)
156 157
157 print s 158 with open(path, 'w') as f:
158 159 f.write(a)
159 #with open(path, 'w') as f:
160 # f.write(a)