From 56367aed12ed0572ae2d3e285ce74b365cccdd0f Mon Sep 17 00:00:00 2001 From: Arthur Kasimov Date: Mon, 28 Aug 2023 15:04:18 +0600 Subject: [PATCH] Pass through shim arguments if user did not specify -a option to shmake --- shim/shim.cpp | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/shim/shim.cpp b/shim/shim.cpp index effceb7..ddd3611 100644 --- a/shim/shim.cpp +++ b/shim/shim.cpp @@ -59,11 +59,18 @@ int wmain(int argc, wchar_t* argv[], wchar_t *envp[]) passed_arg += argv[i]; } - // do token replacement regardless of whether we have an argument or not - if we do, it needs to be deleted anyway - size_t pos = args.find(CMD_TOKEN); - if (pos != string::npos) + if (!args.empty()) + { + // do token replacement regardless of whether we have an argument or not - if we do, it needs to be deleted anyway + size_t pos = args.find(CMD_TOKEN); + if (pos != string::npos) + { + args.replace(pos, CMD_TOKEN.size(), passed_arg); + } + } + else { - args.replace(pos, CMD_TOKEN.size(), passed_arg); + args = passed_arg; } wstring full_cmd = image_path;