The only downloader you need. 下载器的集大成者。
TypeScript asyncasynciobittorentbtcross-platformdownload-managerdownloaderfluent-designftphttp3magnetpyqtpyside6pythonqtquicreactsoftwarestreaming
fix(updater): macOS patch 后重建 symlink + hdiff 最小化
XiaoYouChR098bb7c06fdc
diff --git a/.github/workflows/build.yml b/.github/workflows/build.ymlindex d536a3f1..50603753 100644--- a/.github/workflows/build.yml+++ b/.github/workflows/build.yml@@ -459,10 +459,25 @@ jobs:hdiutil attach "$PREV_DMG" -mountpoint prev-mount -nobrowse -quietOLD_APP=$(find prev-mount -maxdepth 1 -name "*.app" | head -1)+ # Strip symlinks from both sides so hdiffz only sees real files.+ # The updater recreates symlinks after patching (restructureBundle).+ OLD_COPY="dist/old-for-diff"+ NEW_COPY="dist/new-for-diff"+ cp -a "$OLD_APP" "$OLD_COPY"+ cp -a "dist/Ghost Downloader.app" "$NEW_COPY"+ find "$OLD_COPY/Contents/MacOS" -type l -delete 2>/dev/null || true+ find "$NEW_COPY/Contents/MacOS" -type l -delete 2>/dev/null || true+PATCH_FILE="patch-macOS-${{ matrix.architecture }}-${PREV_VER}-to-${{ env.VERSION }}.hdiff"- macos/hdiffz -f "$OLD_APP" "dist/Ghost Downloader.app" "$PATCH_FILE"+ HDIFF_FLAGS="-f"+ # Transition: exclude old features/ to avoid corruption from hot-updated packs+ if [ ! -d "$OLD_COPY/Contents/Resources/features" ]; then+ HDIFF_FLAGS="$HDIFF_FLAGS -g-old#Contents/MacOS/features/"+ fi+ macos/hdiffz $HDIFF_FLAGS "$OLD_COPY" "$NEW_COPY" "$PATCH_FILE"hdiutil detach prev-mount -quiet+ rm -rf "$OLD_COPY" "$NEW_COPY"echo "PATCH_FILE=$PATCH_FILE" >> "$GITHUB_ENV"- name: Upload to releasediff --git a/tools/updater/updater.c b/tools/updater/updater.cindex 818484e6..62b04f10 100644--- a/tools/updater/updater.c+++ b/tools/updater/updater.c@@ -555,6 +555,31 @@ static int buildNewPortableFolder(pchar *dst, size_t len,return 0;}+#ifdef __APPLE__+static void restructureBundle(const char *appDir) {+ char macosDir[PATH_BUF], resourcesDir[PATH_BUF];+ snprintf(macosDir, sizeof(macosDir), "%s/Contents/MacOS", appDir);+ snprintf(resourcesDir, sizeof(resourcesDir), "%s/Contents/Resources", appDir);++ DIR *d = opendir(resourcesDir);+ if (!d) return;+ struct dirent *ent;+ while ((ent = readdir(d)) != NULL) {+ if (ent->d_name[0] == '.') continue;+ char macosPath[PATH_BUF], target[PATH_BUF];+ snprintf(macosPath, sizeof(macosPath), "%s/%s", macosDir, ent->d_name);++ struct stat st;+ if (lstat(macosPath, &st) == 0) continue;++ snprintf(target, sizeof(target), "../Resources/%s", ent->d_name);+ if (symlink(target, macosPath) == 0)+ logMsg("symlink %s -> %s", ent->d_name, target);+ }+ closedir(d);+}+#endif+static int install(const pchar *appDir, const pchar *newDir,const pchar *backupDir, const pchar *exeDir) {if (!hasDir(newDir))@@ -869,6 +894,10 @@ int main(int argc, char *argv[]) {openLog(exeDir);logMsg("installed");+#ifdef __APPLE__+ restructureBundle(appDir);+#endif+logMsg("starting " PFMT, appExe);if (startApp(appExe) != 0) {logMsg("start failed, rolling back");