desktop/source/deployment/misc/dp_misc.cxx | 28 +++++++--------------------- sal/osl/w32/process.cxx | 4 +++- 2 files changed, 10 insertions(+), 22 deletions(-)
New commits: commit fd9c771a32a3f1e00d4d842cca7fb896b774304b Author: Mike Kaganski <[email protected]> AuthorDate: Wed Jul 23 15:32:58 2025 +0500 Commit: Mike Kaganski <[email protected]> CommitDate: Thu Jul 24 00:15:36 2025 +0200 Simplify dp_misc::office_is_running Change-Id: I94b24e4773a8a108544c8b32e643c36cbee0574a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/188226 Tested-by: Jenkins Reviewed-by: Mike Kaganski <[email protected]> diff --git a/desktop/source/deployment/misc/dp_misc.cxx b/desktop/source/deployment/misc/dp_misc.cxx index 4c464bcc943d..5064aa76e0c9 100644 --- a/desktop/source/deployment/misc/dp_misc.cxx +++ b/desktop/source/deployment/misc/dp_misc.cxx @@ -337,31 +337,26 @@ bool office_is_running() //this could cause a deadlock. This is actually a workaround for i82778 OUString sFile; oslProcessError err = osl_getExecutableFile(& sFile.pData); - bool ret = false; if (osl_Process_E_None == err) { - sFile = sFile.copy(sFile.lastIndexOf('/') + 1); if ( #if defined MACOSX - sFile == "soffice" + sFile.endsWith("/soffice") #elif defined UNIX | defined _WIN32 - sFile == "soffice.bin" + sFile.endsWith("/soffice.bin") #else #error "Unsupported platform" #endif ) - ret = true; - else - ret = existsOfficePipe(); + return true; } else { OSL_FAIL("NOT osl_Process_E_None "); - //if osl_getExecutable file then we take the risk of creating a pipe - ret = existsOfficePipe(); + //if osl_getExecutableFile failed then we take the risk of creating a pipe } - return ret; + return existsOfficePipe(); #endif } commit d9431eec69add51e15eb9217f456c2b1bbb44ce2 Author: Mike Kaganski <[email protected]> AuthorDate: Wed Jul 23 15:23:25 2025 +0500 Commit: Mike Kaganski <[email protected]> CommitDate: Thu Jul 24 00:15:26 2025 +0200 Drop special case for Windows from dp_misc::office_is_running Obsoleted by commit c650217cc543080928a26de4bfc07ebb0be5c6ca (tdf#124776: don't use SearchPathW to get full path of executable, 2019-04-17), which side effect made osl_getExecutableFile return correct executable name. Change-Id: I362beaaeaf86cfa1a639e76ec6bfc13a14685f17 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/188223 Tested-by: Jenkins Reviewed-by: Mike Kaganski <[email protected]> diff --git a/desktop/source/deployment/misc/dp_misc.cxx b/desktop/source/deployment/misc/dp_misc.cxx index 92499c6c8408..4c464bcc943d 100644 --- a/desktop/source/deployment/misc/dp_misc.cxx +++ b/desktop/source/deployment/misc/dp_misc.cxx @@ -342,18 +342,9 @@ bool office_is_running() { sFile = sFile.copy(sFile.lastIndexOf('/') + 1); if ( -#if defined _WIN32 - //osl_getExecutableFile should deliver "soffice.bin" on windows - //even if swriter.exe, scalc.exe etc. was started. This is a bug - //in osl_getExecutableFile - sFile == "soffice.bin" || sFile == "soffice.exe" || sFile == "soffice.com" - || sFile == "soffice" || sFile == "swriter.exe" || sFile == "swriter" - || sFile == "scalc.exe" || sFile == "scalc" || sFile == "simpress.exe" - || sFile == "simpress" || sFile == "sdraw.exe" || sFile == "sdraw" - || sFile == "sbase.exe" || sFile == "sbase" -#elif defined MACOSX +#if defined MACOSX sFile == "soffice" -#elif defined UNIX +#elif defined UNIX | defined _WIN32 sFile == "soffice.bin" #else #error "Unsupported platform" diff --git a/sal/osl/w32/process.cxx b/sal/osl/w32/process.cxx index cbea6cf2df94..8f5f016c7ae5 100644 --- a/sal/osl/w32/process.cxx +++ b/sal/osl/w32/process.cxx @@ -329,7 +329,9 @@ static rtl_uString ** osl_createCommandArgs_Impl (int argc, char **) } LocalFree(wargv); { - /* Ensure absolute path */ + /* Ensure absolute path. Additionally, this may replace possible s*.exe (from original + command line, passed from launcher down to this process) with soffice.bin - that + fixes osl_getExecutableFile */ osl::LongPathBuffer<sal_Unicode> aBuffer(EXTENDED_MAX_PATH); DWORD dwResult = GetModuleFileNameW(nullptr, o3tl::toW(aBuffer), aBuffer.getBufSizeInSymbols());
