Skip to content

The only downloader you need. 下载器的集大成者。

Merge branch 'main' of https://github.com/xiaoYouChR/Ghost-Downloader-3

XiaoYouChRbf3febaaa719
diff --cc CONTEXT.md
index 02ec4222,71e9072c..669f889c
--- a/CONTEXT.md
+++ b/CONTEXT.md
@@@ -124,40 -126,18 +126,50 @@@ _Avoid_: group、tag、typ
应用级用户配置。
_Avoid_: options(options 是每个 Task 的输入,不是应用配置)
+### 应用更新
+
+**App Dir**:
+正在使用的安装目录。
+_Avoid_: install dir、program folder
+
+**Patch**:
+一份目录级增量文件。
+_Avoid_: delta、diff
+
+**Staging**:
+更新下载物的落地目录。
+_Avoid_: cache、temp
+
+**New Dir**:
+App Dir 旁已经打好的新树。
+_Avoid_: dest、out
+
+**Backup Dir**:
+App Dir 改名让出后的旧树。
+_Avoid_: old、prev
+
+**Updater**:
+进程外的更新程序:等应用退出后做 Patch 与 Install。
+_Avoid_: helper、installer
+
+**Apply**:
+退出时把已就绪的更新交出去:Pack 就地暂存,应用则启动 Updater。
+_Avoid_: install、commit
+
+**Install**:
+Updater 把 New Dir 换成 App Dir。
+_Avoid_: swap、rename、deploy
+ ### 更新分发
+
+ **Origin**:
+ 应用更新与附属二进制的权威托管方。构建、打 tag、发布资产以 Origin 为准。当前是 GitHub。
+ _Avoid_: source of truth 单独当术语;不叫 primary / 主镜像
+
+ **Source**:
+ 客户端竞速拉取更新元数据和资产的一个托管端点。当前集合是 github 与 gitcode。
+ _Avoid_: Mirror、CDN、channel;CNB 不是 Source
+
-
## Example dialogue
> **Dev:** "用户按暂停时,我们删除 Task 吗?"
diff --cc tools/updater/updater.c
index 58cfbaf3,a48c143e..c9c47d04
--- a/tools/updater/updater.c
+++ b/tools/updater/updater.c
@@@ -500,18 -429,7 +538,18 @@@ int main(int argc, char *argv[])
#endif
findExeDir(updaterDir, PATH_BUF);
- openLog(appDir);
+ openLog();
+#ifdef _WIN32
+ if (relocated < 0) {
+ logMsg("cannot copy updater out of appDir");
+ closeLog();
+ return EXIT_RENAME_FAILED;
+ }
+ /* Windows locks the process cwd against MoveFile. */
+ if (updaterDir[0] && !SetCurrentDirectoryW(updaterDir))
+ logMsg("SetCurrentDirectory \"" PFMT "\" failed (err=%lu)",
+ updaterDir, GetLastError());
+#endif
logMsg(" __________ __ ______ ____ ___ ________________");
logMsg(" / ____/ __ \\ / / / / __ \\/ __ \\/ |/_ __/ ____/ __ \\");
logMsg(" / / __/ / / / / / / / /_/ / / / / /| | / / / __/ / /_/ /");