From d292add15e5b87b53966953c3908657974f0a5b9 Mon Sep 17 00:00:00 2001 From: Leonmmcoset Date: Tue, 2 Sep 2025 09:55:42 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E5=B0=86=E7=BC=93=E5=AD=98=E7=9B=AE?= =?UTF-8?q?=E5=BD=95=E4=BB=8E/rom/cache=E7=A7=BB=E5=8A=A8=E5=88=B0/package?= =?UTF-8?q?s/cache=E5=B9=B6=E7=A1=AE=E4=BF=9D=E7=9B=AE=E5=BD=95=E5=AD=98?= =?UTF-8?q?=E5=9C=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 确保缓存目录与其它包相关文件位于同一位置,提高文件组织的一致性。同时在安装过程中检查并创建缓存目录。 --- data/computercraft/lua/rom/programs/pkg.lua | 2 +- installer.lua | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/data/computercraft/lua/rom/programs/pkg.lua b/data/computercraft/lua/rom/programs/pkg.lua index adc3457..7b75f57 100644 --- a/data/computercraft/lua/rom/programs/pkg.lua +++ b/data/computercraft/lua/rom/programs/pkg.lua @@ -28,7 +28,7 @@ local pkg_config = { repo_url = "https://example.com/leonos/packages", -- 包仓库URL local_pkg_dir = "/packages", -- 本地包存储目录 installed_db = "/packages/installed.json", -- 已安装包数据库 - cache_dir = "/rom/cache" -- 缓存目录 + cache_dir = "/packages/cache" -- 缓存目录 } -- 确保必要的目录存在 diff --git a/installer.lua b/installer.lua index 0245f11..122dce7 100644 --- a/installer.lua +++ b/installer.lua @@ -145,6 +145,11 @@ end ok() bullet("Creating directories...") +-- 确保缓存目录存在 +local cache_dir = "/packages/cache" +if not fs.exists(cache_dir) then + fs.makeDir(cache_dir) +end for i=#to_dl, 1, -1 do local v = to_dl[i] if v.type == "tree" then