cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - Did you get an answer that solved your problem? Please mark it as an Accepted Solution so others with the same problem can find the answer easily. X

MKS C API mksCommand structure holding a simple parameter?

tnagy
3-Visitor

MKS C API mksCommand structure holding a simple parameter?

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?

1 ACCEPTED SOLUTION

Accepted Solutions
mrump
14-Alexandrite
(To:tnagy)

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

View solution in original post

2 REPLIES 2
mrump
14-Alexandrite
(To:tnagy)

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

tnagy
3-Visitor
(To:mrump)

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!

Top Tags