Skip to content

Commit

Permalink
onebinary: rewrite program_invocation_short_name
Browse files Browse the repository at this point in the history
this is not very portable
  • Loading branch information
iameli committed May 22, 2024
1 parent efa0592 commit e306e79
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions scripts/onebinary_gen.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@
# '#include "src/controller/controller.cpp"',
'int main(int argc, char *argv[]){',
' if (argc < 2) {',
' program_invocation_short_name = (char *)"MistController";'
' return ControllerMain(argc, argv);',
' }',
' // Create a new argv array without argv[1]',
Expand All @@ -129,6 +130,7 @@
for cap in capabilities:
entrypoint_lines.extend([
' else if (strcmp(argv[1], "' + cap['binary_name'] + '") == 0) {',
' program_invocation_short_name = argv[1];'
' return ' + cap['func_name'] +'<' + cap['class_name'] + '>(new_argc, new_argv);',
' }',
])
Expand All @@ -138,6 +140,7 @@
' return SessionMain(new_argc, new_argv);',
' }',
' else {',
' program_invocation_short_name = (char *)"MistController";',
' return ControllerMain(argc, argv);',
' }',
' INFO_MSG("binary not found: %s", argv[1]);',
Expand Down

0 comments on commit e306e79

Please sign in to comment.