• Roland Baudin's avatar
    tdf#96038 Make shell function work with paths containing spaces · cf89d6db
    Roland Baudin yazdı
    Explanation of the patch: in the Windows version of LibreOffice,
    when calling the basic Shell(...) function (located in
    basic/source/runtime/methods.cxx), a function is_batch_file()
    is called in turn, to check if the program file path to execute
    is a batch or an executable.
    
    The function is_batch_file() is located in sal/osl/w32/procimpl.cxx
    and simply checks if the file extension is equal to bat (or cmd or
    btm).
    
    This works as expected, except when the file path contains space
    characters. In that case, the file path is *quoted* before the
    call to is_batch_file() and for a batch file the file extension
    becomes bat" (note the quote) instead of bat, and thus the call
    to is_batch_file() wrongly returns false in that case.
    
    In this patch, the issue is fixed by changing the function
    get_file_extension() to make it return the correct extension
    (i.e. without the '"' character) when the file name is quoted.
    
    Change-Id: Ib6e74da87b23d64db925c17f8a26617f1a86a83d
    Reviewed-on: https://gerrit.libreoffice.org/69230
    Tested-by: Jenkins
    Reviewed-by: 's avatarStephan Bergmann <sbergman@redhat.com>
    cf89d6db
procimpl.cxx 19.4 KB