fdo#33852 do not remove too much from the path

Change-Id: I1cf89f300530e761df5a287097d05f95d8af2017
(cherry picked from commit eba6a6789c8832f961ac7054588ed84d04b65480)
Reviewed-on: https://gerrit.libreoffice.org/7900
Reviewed-by: Fridrich Strba <fridrich@documentfoundation.org>
Tested-by: Fridrich Strba <fridrich@documentfoundation.org>