23 lines
825 B
Bash
23 lines
825 B
Bash
#!/bin/zsh
|
|
cd "$(/usr/bin/dirname "$0")" || exit 1
|
|
fail() {
|
|
print -r -- "$1"
|
|
if [[ -t 0 ]]; then read -r "?按回车关闭…"; fi
|
|
exit 1
|
|
}
|
|
case "$(/usr/bin/uname -m)" in
|
|
arm64) editor_arch=arm64 ;;
|
|
x86_64) editor_arch=x64 ;;
|
|
*) fail "不支持此处理器;请使用 Apple 芯片或 Intel Mac。" ;;
|
|
esac
|
|
editor_node="./runtime/darwin-${editor_arch}/node"
|
|
[[ -x "$editor_node" ]] || fail "缺少可执行运行环境,请完整解压 ZIP 后再打开。"
|
|
[[ -w . ]] || fail "当前文件夹不可写,请将整个编辑器文件夹移到可写的位置。"
|
|
"$editor_node" "StartEditor.mjs" "$@"
|
|
editor_exit=$?
|
|
if (( editor_exit != 0 )); then
|
|
print -r -- "编辑器退出,错误码:${editor_exit}。请查看上方提示。"
|
|
if [[ -t 0 ]]; then read -r "?按回车关闭…"; fi
|
|
fi
|
|
exit "$editor_exit"
|