Bug 146098

Summary: setsdkenv_windows.bat failed with LO directory containing parenthesis ( ex: C:\Program Files (x86)\LibreOffice )
Product: LibreOffice Reporter: Marc Le Douarain <marc.le.douarain>
Component: sdkAssignee: Not Assigned <libreoffice-bugs>
Status: UNCONFIRMED ---    
Severity: normal CC: sberg.fun, serval2412
Priority: medium    
Version: Inherited From OOo   
Hardware: All   
OS: Windows (All)   
Whiteboard:
Crash report or crash signature: Regression By:

Description Marc Le Douarain 2021-12-07 15:26:45 UTC
Description:
The batch setsdk for windows will fail when pointing a LibreOffice directory containing parenthesis.
When installing 32 bits version of LibreOffice (x86), the trouble appears because you have generally to set in setsdkenv_windows.bat
set OFFICE_HOME=C:\Program Files (x86)\LibreOffice
and the batch file doesn't support quotes for directory and trouble later with "if defined xxxx ( ... )" expressions then...


Here what I've done to be able to compile sdk examples, by modifying some lines in file "setsdkenv_windows.bat" (stored for me at "C:\Users\USERNAME\AppData\Roaming\libreoffice7.1_sdk"


REM ***** IF PRESENCE OF PARENTHESES LIKE '(x86)', ADD QUOTES FOR THIS PATH HERE !!!!! *****
set OFFICE_HOME="C:\Program Files (x86)\LibreOffice"

...

REM ***** COMMENT THESES LINES NOT USED ****
REM if defined CPP_WINDOWS_SDK (
REM     set LIB=%LIB%;%CPP_WINDOWS_SDK%\lib
REM  )

...


if defined OFFICE_HOME (
   set UNO_PATH=%OFFICE_PROGRAM_PATH%
 )

REM ***** ADDED HERE TO REMOVE NOW THE TEMPORARY QUOTES IN PATH VARIABLES... *****
set OFFICE_HOME=%OFFICE_HOME:"=%
set OFFICE_PROGRAM_PATH=%OFFICE_PROGRAM_PATH:"=%
set UNO_PATH=%UNO_PATH:"=%

set OO_SDK_URE_BIN_DIR=%OFFICE_PROGRAM_PATH%
set OO_SDK_URE_LIB_DIR=%OFFICE_PROGRAM_PATH%
set OO_SDK_URE_JAVA_DIR=%OFFICE_PROGRAM_PATH%\classes
set OO_SDK_OFFICE_BIN_DIR=%OFFICE_PROGRAM_PATH%
set OO_SDK_OFFICE_LIB_DIR=%OFFICE_PROGRAM_PATH%
set OO_SDK_OFFICE_JAVA_DIR=%OFFICE_PROGRAM_PATH%\classes


And batch modified like that is working with LibreOffice installed in "C:\Program Files (x86)\LibreOffice" directory !



Actual Results:
set sdk Windows batch launch failed.


Expected Results:
An error appeared when launching the batch file.



Reproducible: Always


User Profile Reset: No



Additional Info:
"Shell prepared for sdk" in the title.
to indicate that sdk examples can now be compiled from it.
Comment 1 Julien Nabet 2021-12-07 20:18:01 UTC
Code pointer odk/config/setsdkenv_windows.bat
(https://opengrok.libreoffice.org/xref/core/odk/config/setsdkenv_windows.bat?r=7d69efd0)

Stephan: thought you might be interested in this one since it concerns SDK moreover the reporter proposes a solution.