I’m very sorry, but I don’t understand, trying to write app for LibreOffice made using SDK.
Im trying to get argv from main command arguments
I send string in command argument “file:///C:\Users\USER\CProjects\test\test2.docx”
And by the examples i have to get path arg sAbsoluteDocUrl with commands:
OUString sAbsoluteDocUrl, sWorkingDir, sDocPathUrl, sArgDocUrl;
rtl_getAppCommandArg(0, &sArgDocUrl.pData);
osl_getProcessWorkingDir(&sWorkingDir.pData);
osl::FileBase::getFileURLFromSystemPath(sArgDocUrl, sDocPathUrl);
osl::FileBase::getAbsoluteFileURL(sWorkingDir, sDocPathUrl, sAbsoluteDocUrl);
and then make
Reference< XComponent > xMainComponent = xDesktop2->loadComponentFromURL(
sAbsoluteDocUrl, OUString("_blank"),
0, loadProps);
but sAbsoluteDocUrl don’t have url finally
but if i put
rtl::OUString path = "file:///C:\\Users\\USER\\CProjects\\test\\test2.docx";
and then run
Reference< XComponent > xMainComponent = xDesktop2->loadComponentFromURL(
path , OUString("_blank"),
0, loadProps);
the document would run succesfully.
How to get args correctly?
Is it realy nessesary run something like
-env:URE_MORE_TYPES=\"file:///.../program/offapi.rdb\" \"file:///e:/temp/test.odt\" \"uno:socket,host=localhost,port=2083;urp;StarOffice.ServiceManager\"\n"
as it described in DocumentLoader.cxx
https://api.libreoffice.org/examples/examples.html#Cpp_examples