|
|
@@ -16,3 +16,41 @@ rsync -a --delete "${PROJECT_ROOT}/WebRoot/" "${WEBAPP_DIR}/"
|
|
|
echo "已同步 WebRoot -> ${WEBAPP_DIR}"
|
|
|
|
|
|
"${SCRIPT_DIR}/apply-local-runtime-config.sh"
|
|
|
+
|
|
|
+if [[ "$(uname -s)" == "Darwin" ]]; then
|
|
|
+ libreoffice_path="${ZQ_LIBREOFFICE_MAC_PATH:-}"
|
|
|
+ if [[ -z "${libreoffice_path}" ]]; then
|
|
|
+ for candidate in \
|
|
|
+ "/Applications/LibreOffice.app/Contents/MacOS/soffice" \
|
|
|
+ "$(command -v soffice 2>/dev/null || true)" \
|
|
|
+ "$(command -v libreoffice 2>/dev/null || true)"; do
|
|
|
+ if [[ -n "${candidate}" && -x "${candidate}" ]]; then
|
|
|
+ libreoffice_path="${candidate}"
|
|
|
+ break
|
|
|
+ fi
|
|
|
+ done
|
|
|
+ fi
|
|
|
+
|
|
|
+ if [[ -n "${libreoffice_path}" && -x "${libreoffice_path}" ]]; then
|
|
|
+ /usr/bin/python3 - "${WEBAPP_DIR}/WEB-INF/application.xml" "${libreoffice_path}" <<'PY'
|
|
|
+import re
|
|
|
+import sys
|
|
|
+from pathlib import Path
|
|
|
+
|
|
|
+config = Path(sys.argv[1])
|
|
|
+path = sys.argv[2]
|
|
|
+content = config.read_text(encoding="utf-8")
|
|
|
+content, count = re.subn(
|
|
|
+ r"<libreOfficeMacOrMacOSXPath>.*?</libreOfficeMacOrMacOSXPath>",
|
|
|
+ f"<libreOfficeMacOrMacOSXPath>{path}</libreOfficeMacOrMacOSXPath>",
|
|
|
+ content,
|
|
|
+ count=1,
|
|
|
+)
|
|
|
+if count:
|
|
|
+ config.write_text(content, encoding="utf-8")
|
|
|
+PY
|
|
|
+ echo "本地 LibreOffice 路径:${libreoffice_path}"
|
|
|
+ else
|
|
|
+ echo "提醒:未找到可执行的 LibreOffice,Word 导入将回退 Mammoth 基础格式。"
|
|
|
+ fi
|
|
|
+fi
|