I have this code below: std::wstring stdwstr(stdstr.begin(), stdstr.end()); ON_wString script; script.Format(L"_-Open \"%ls\" _Enter", stdwstr.c_str()); RhinoApp().RunScript(context.m_doc.RuntimeSerialNumber(), script.Array());
where stdstr = is a std::string
The resulting command in Rhino is three different commands:
1- _-Open
2- The path passed to format
3- _Enter
Is there a reason why this is happening? And what’s the sane way to work with those wide strings that complicate all the code base?
I’m not sure completely understand the question. But if you are just looking to script Rhino’s Open command from a plug-in command, you might have a look at cmdSampleOpen3dmFile.cpp.
Otherwise, have a look a the ON_String and ON_wString classes in opennurbs_string.h.