Files
ElyOffice/packaging/windows/templates.sh
T
ZacharyZhang-NYandClaude Opus 5.5 632a66eb46 R7.9: Explorer's New makes docx, xlsx, pptx and md on Windows
Each app installs a blank file and points ShellNew at it. Explorer
lists a type only through its default class, so a type no program
handles (no default, or one naming no class) gets the app's class;
an installed handler is never replaced. Uninstall removes only what
this install wrote.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-17 00:32:48 -04:00

26 lines
843 B
Bash

#!/usr/bin/env bash
# Writes packaging/windows/new: the blank files Explorer's New makes.
set -euo pipefail
root=$(cd "$(dirname "$0")/../.." && pwd)
soffice=$root/engines/lo-src/instdir/program/soffice.com
[ -x "$soffice" ] || {
echo "templates.sh: no kernel at $soffice; run scripts/build-libreoffice.sh" >&2
exit 1
}
out=$root/packaging/windows/new
work=$(mktemp -d)
trap 'rm -rf "$work"' EXIT
mkdir "$work/in"
# The kernel reads an empty file as a new document.
for ext in docx xlsx pptx; do
: >"$work/in/new.$ext"
"$soffice" --headless --norestore "-env:UserInstallation=file:///$(cygpath -m "$work/profile")" \
--convert-to "$ext" --outdir "$(cygpath -w "$out")" "$(cygpath -w "$work/in/new.$ext")"
[ -s "$out/new.$ext" ] || {
echo "templates.sh: the kernel wrote no new.$ext" >&2
exit 1
}
done
: >"$out/new.md"