Community Tip - Stay updated on what is happening on the PTC Community by subscribing to PTC Community Announcements. X
I have a problem using the mksCommand structure using the MKS C API. I am reaching the server via Source Integrity (2009, build: 4.10.0.9049), and the environment is setup correctly, most commands works flawlessly. My problem arose with the createsandbox command, but it should be the same with every other command that uses a parameter like that (ci, co, for example), but I haven't reached those yet in my implementation.
// This works fine
mksCommand actcmd = mksCreateCommand();
actcmd->appName = (wchar_t*) L"si";
string e = GetSBPath(); // obviously this is an inside look into a much more complex application, but it does work
actcmd->cmdName = (wchar_t*) L"viewsandbox";
mksOptionListAdd(actcmd->optionList, (wchar_t*) L"sandbox", wstring(e.begin(), e.end()).c_str());
mksResponse response = mksCmdRunnerExecCmd(cmdrunner, actcmd, INTERIM_CACHE);
etc.
However when I want to do the same for createsandbox, I have no clue how to use mksCommand for the last parameter, which would specify the sandbox directory. There is no "--sandbox" or "--directory" parameter, and the mksSelectionListAdd() and the mksOptionListAdd() commands both add the "--" automatically to the respective mksCommand parameter, as far as I know. Do I have an option to still use the mksCommand structure for this somehow, or do I need to 'fall back' to the wchar_t* array solution instead of the more structured approach?
Solved! Go to Solution.
Hi Tibor,
"options" are not the only thing you can/must pass to a command; there is also the "SelectionList".
Basically all CLI command look like this
"<application> <command> <options> <selectionlist>"
So in your case
"si createsandbox <options...> <selectionlist>"
All you need to do is create a SelectionList, add your sandbox directory and pass this selectionlist to the command.
HTH Matthias
Hi Tibor,
"options" are not the only thing you can/must pass to a command; there is also the "SelectionList".
Basically all CLI command look like this
"<application> <command> <options> <selectionlist>"
So in your case
"si createsandbox <options...> <selectionlist>"
All you need to do is create a SelectionList, add your sandbox directory and pass this selectionlist to the command.
HTH Matthias
Hi Mathias,
thank you for your response, it worked! I have found the mksSelectionListAdd() method before in the source files (was not even mentioned in the API description I have), but as there were no comments about how it worked, I assumed it was the pair of mksOptionListAdd() for simple parameters like '--batch' and '--shared'.
Thanks for clearing this up!