From 44a696758d1e72c353d30966b8451a38537a9333 Mon Sep 17 00:00:00 2001 From: Leonmmcoset Date: Mon, 1 Sep 2025 10:15:12 +0800 Subject: [PATCH] =?UTF-8?q?refactor:=20=E5=B0=86=E9=BB=98=E8=AE=A4?= =?UTF-8?q?=E8=B7=AF=E5=BE=84=E4=BB=8E/rc=E6=9B=B4=E6=94=B9=E4=B8=BA/leono?= =?UTF-8?q?s?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 统一修改代码中的默认路径,从/rc变更为/leonos,以反映系统名称变更 --- data/computercraft/lua/bios.lua | 2 +- data/computercraft/lua/rom/apis/help.lua | 2 +- data/computercraft/lua/rom/apis/keys.lua | 2 +- data/computercraft/lua/rom/apis/shell.lua | 2 +- data/computercraft/lua/rom/editors/advanced.lua | 2 +- data/computercraft/lua/rom/modules/main/rc/thread.lua | 2 +- data/computercraft/lua/rom/programs/craftos.lua | 2 +- data/computercraft/lua/rom/programs/edit.lua | 4 ++-- data/computercraft/lua/rom/programs/shell.lua | 2 +- data/computercraft/lua/rom/startup/00_fs.lua | 6 +++--- data/computercraft/lua/rom/startup/10_package.lua | 4 ++-- updater.lua | 4 ++-- 12 files changed, 17 insertions(+), 17 deletions(-) diff --git a/data/computercraft/lua/bios.lua b/data/computercraft/lua/bios.lua index 5cc0951..fd0c3aa 100644 --- a/data/computercraft/lua/bios.lua +++ b/data/computercraft/lua/bios.lua @@ -1,7 +1,7 @@ _G._HOST = _G._HOST .. " (LeonOS 0.1.4)" local fs = rawget(_G, "fs") -_G._RC_ROM_DIR = _RC_ROM_DIR or (...) and fs.exists("/rc") and "/rc" or "/rom" +_G._RC_ROM_DIR = _RC_ROM_DIR or (...) and fs.exists("/leonos") and "/leonos" or "/rom" if fs.exists("/.start_rc.lua") and not (...) then _G._RC_USED_START = true diff --git a/data/computercraft/lua/rom/apis/help.lua b/data/computercraft/lua/rom/apis/help.lua index 6976736..2e5ed23 100644 --- a/data/computercraft/lua/rom/apis/help.lua +++ b/data/computercraft/lua/rom/apis/help.lua @@ -6,7 +6,7 @@ local expect = require("cc.expect").expect local completion = require("cc.completion") local help = {} -help._DEFAULT_PATH = "/rc/help" +help._DEFAULT_PATH = "/leonos/help" function help.init() local vars = thread.vars() diff --git a/data/computercraft/lua/rom/apis/keys.lua b/data/computercraft/lua/rom/apis/keys.lua index ce7061d..c98db0d 100644 --- a/data/computercraft/lua/rom/apis/keys.lua +++ b/data/computercraft/lua/rom/apis/keys.lua @@ -14,7 +14,7 @@ elseif mcver <= 12 or _HOST:match("LeonOS%-PC") then kmap = "lwjgl2" end -local base = dofile("/rc/keymaps/"..kmap..".lua") +local base = dofile("/leonos/keymaps/"..kmap..".lua") local lib = {} -- reverse-index it! diff --git a/data/computercraft/lua/rom/apis/shell.lua b/data/computercraft/lua/rom/apis/shell.lua index 06a7cd7..2f782a6 100644 --- a/data/computercraft/lua/rom/apis/shell.lua +++ b/data/computercraft/lua/rom/apis/shell.lua @@ -32,7 +32,7 @@ function shell.init(env) copyIfPresent("aliases", vars) completions[vars.parentShell or 0] = completions[vars.parentShell or 0] or {} - vars.path = vars.path or ".:/rc/programs" + vars.path = vars.path or ".:/leonos/programs" vars.env = env or _ENV or _G end diff --git a/data/computercraft/lua/rom/editors/advanced.lua b/data/computercraft/lua/rom/editors/advanced.lua index f8f594e..5d9cd01 100644 --- a/data/computercraft/lua/rom/editors/advanced.lua +++ b/data/computercraft/lua/rom/editors/advanced.lua @@ -87,7 +87,7 @@ local function redraw() end local syntax = require("edit.syntax") - .new("/rc/modules/main/edit/syntax/lua.lua") + .new("/leonos/modules/main/edit/syntax/lua.lua") local function rehighlight() local line = {} diff --git a/data/computercraft/lua/rom/modules/main/rc/thread.lua b/data/computercraft/lua/rom/modules/main/rc/thread.lua index 9258c57..1238ff5 100644 --- a/data/computercraft/lua/rom/modules/main/rc/thread.lua +++ b/data/computercraft/lua/rom/modules/main/rc/thread.lua @@ -360,7 +360,7 @@ function api.start() local _native = term.native() wrappedNative = window.create(_native, 1, 1, _native.getSize()) - api.launchTab("/rc/programs/shell.lua", "shell") + api.launchTab("/leonos/programs/shell.lua", "shell") rc.pushEvent("init") diff --git a/data/computercraft/lua/rom/programs/craftos.lua b/data/computercraft/lua/rom/programs/craftos.lua index 6f54f62..bb1f260 100644 --- a/data/computercraft/lua/rom/programs/craftos.lua +++ b/data/computercraft/lua/rom/programs/craftos.lua @@ -53,6 +53,6 @@ function nEnv.os.version() return "LeonOS 1.0 ALpha 1" end -local func, err = loadfile("/rc/programs/shell.lua", "t", nEnv) +local func, err = loadfile("/leonos/programs/shell.lua", "t", nEnv) if not func then error(err, 0) end func() diff --git a/data/computercraft/lua/rom/programs/edit.lua b/data/computercraft/lua/rom/programs/edit.lua index 4885272..d19fa00 100644 --- a/data/computercraft/lua/rom/programs/edit.lua +++ b/data/computercraft/lua/rom/programs/edit.lua @@ -23,7 +23,7 @@ local settings = require("settings") local df = function(f, ...) return assert(loadfile(f))(...) end if term.isColor() or settings.get("edit.force_highlight") then - df("/rc/editors/advanced.lua", ...) + df("/leonos/editors/advanced.lua", ...) else - df("/rc/editors/basic.lua", ...) + df("/leonos/editors/basic.lua", ...) end diff --git a/data/computercraft/lua/rom/programs/shell.lua b/data/computercraft/lua/rom/programs/shell.lua index 7982b92..5da974a 100644 --- a/data/computercraft/lua/rom/programs/shell.lua +++ b/data/computercraft/lua/rom/programs/shell.lua @@ -74,7 +74,7 @@ for k, v in pairs(aliases) do shell.setAlias(k, v) end -local completions = "/rc/completions" +local completions = "/leonos/completions" for _, prog in ipairs(fs.list(completions)) do dofile(fs.combine(completions, prog)) end diff --git a/data/computercraft/lua/rom/startup/00_fs.lua b/data/computercraft/lua/rom/startup/00_fs.lua index 454dea0..0690112 100644 --- a/data/computercraft/lua/rom/startup/00_fs.lua +++ b/data/computercraft/lua/rom/startup/00_fs.lua @@ -22,7 +22,7 @@ local function expect(...) end -- path resolution: --- if the path begins with /rc, then redirect to wherever that actually +-- if the path begins with /leonos, then redirect to wherever that actually -- is; otherwise, resolve the path based on the current program's working -- directory -- this is to allow .OS to run from anywhere @@ -72,8 +72,8 @@ function fs.list(path) local _, files = pcall(list, path) if not _ then return nil, files end if path == "/" then - -- inject /rc into the root listing - if not exists("/rc") then + -- inject /leonos into the root listing + if not exists("/leonos") then files[#files+1] = "rc" end end diff --git a/data/computercraft/lua/rom/startup/10_package.lua b/data/computercraft/lua/rom/startup/10_package.lua index 8b4fd23..9726080 100644 --- a/data/computercraft/lua/rom/startup/10_package.lua +++ b/data/computercraft/lua/rom/startup/10_package.lua @@ -6,7 +6,7 @@ _G.package = {} package.config = "/\n;\n?\n!\n-" package.cpath = "" -package.path = "/rc/apis/?.lua;/rc/modules/main/?.lua;./lib/?.lua;./lib/?/init.lua;./?.lua;./?/init.lua" +package.path = "/leonos/apis/?.lua;/leonos/modules/main/?.lua;./lib/?.lua;./lib/?/init.lua;./?.lua;./?/init.lua" local function rm(api) local tab = _G[api] @@ -76,7 +76,7 @@ package.searchers = { local fs = package.loaded.fs -- require isn't here yet -local expect = loadfile("/rc/modules/main/cc/expect.lua")() +local expect = loadfile("/leonos/modules/main/cc/expect.lua")() package.loaded["cc.expect"] = expect function package.searchpath(name, path, sep, rep) diff --git a/updater.lua b/updater.lua index 2999d3b..fe10da0 100644 --- a/updater.lua +++ b/updater.lua @@ -4,8 +4,8 @@ local fs = rawget(_G, "fs") local term = rawget(_G, "term") local http = rawget(_G, "http") -_G._RC_ROM_DIR = _RC_ROM_DIR or "/rc" -if _RC_ROM_DIR == "/rom" then _RC_ROM_DIR = "/rc" end +_G._RC_ROM_DIR = _RC_ROM_DIR or "/leonos" +if _RC_ROM_DIR == "/rom" then _RC_ROM_DIR = "/leonos" end -- fail-safe local start_rc = [[