From 89d582ad89d6fa0e3660a195769cb5f6e1706fff Mon Sep 17 00:00:00 2001 From: 1024jp <1024jp@wolfrosch.com> Date: Sat, 28 Feb 2026 15:30:21 +0900 Subject: [PATCH] Remove bundles for tree-sitter languages from CotEditor.app --- CotEditor.xcodeproj/project.pbxproj | 11 ++++ Scripts/removeTreeSitterBundles.sh | 78 +++++++++++++++++++++++++++++ 2 files changed, 89 insertions(+) create mode 100755 Scripts/removeTreeSitterBundles.sh diff --git a/CotEditor.xcodeproj/project.pbxproj b/CotEditor.xcodeproj/project.pbxproj index 3fda08787..3a179e03e 100644 --- a/CotEditor.xcodeproj/project.pbxproj +++ b/CotEditor.xcodeproj/project.pbxproj @@ -212,6 +212,7 @@ 2A6F0D541B5500E100C2D03C /* Resources */, 2A94FC7A1BE225E900B454A8 /* Copy Command-Line Tools */, 2A6F0DFD1B5500E100C2D03C /* Frameworks */, + 2BF32A522F06996600A1C703 /* Remove Tree-sitter Bundles */, ); buildRules = ( ); @@ -383,6 +384,16 @@ "", ); }; + 2BF32A522F06996600A1C703 /* Remove Tree-sitter Bundles */ = { + isa = PBXShellScriptBuildPhase; + name = "Remove Tree-sitter Bundles"; + runOnlyForDeploymentPostprocessing = 1; + shellPath = /bin/sh; + shellScript = ( + "\"$SRCROOT/Scripts/removeTreeSitterBundles.sh\"", + "", + ); + }; /* End PBXShellScriptBuildPhase section */ /* Begin PBXSourcesBuildPhase section */ diff --git a/Scripts/removeTreeSitterBundles.sh b/Scripts/removeTreeSitterBundles.sh new file mode 100755 index 000000000..bb5c32cbf --- /dev/null +++ b/Scripts/removeTreeSitterBundles.sh @@ -0,0 +1,78 @@ +#!/bin/sh + +# removeTreeSitterBundles.sh +# +# CotEditor +# https://coteditor.com +# +# Created by 1024jp on 2026-02-28. +# +# ------------------------------------------------------------------------------ +# +# © 2026 1024jp +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +set -eu + +appResources="${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}" + +if [ ! -d "${appResources}" ]; then + exit 0 +fi + +is_removable_bundle() { + bundlePath="$1" + + # Strip leading "bundlePath/" and validate remaining relative paths. + # Allow only: + # - Contents/Info.plist + # - Contents/Resources/queries/*.scm + while IFS= read -r absolutePath; do + relativePath="${absolutePath#"${bundlePath}/"}" + + case "${relativePath}" in + Contents/Info.plist) + ;; + Contents/Resources/queries/*.scm) + ;; + *) + return 1 + ;; + esac + done <