refactor: 将默认路径从/rc更改为/leonos

更新所有相关文件中的路径引用,统一使用/leonos作为系统目录。同时更新版本号至0.1.7。
This commit is contained in:
2025-09-01 11:03:43 +08:00
parent 3aeefb94c5
commit 976769de2d
14 changed files with 35 additions and 35 deletions

View File

@@ -1,7 +1,7 @@
_G._HOST = _G._HOST .. " (LeonOS 0.1.2)" _G._HOST = _G._HOST .. " (LeonOS 0.1.7)"
local fs = rawget(_G, "fs") 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 if fs.exists("/.start_rc.lua") and not (...) then
_G._RC_USED_START = true _G._RC_USED_START = true

View File

@@ -6,7 +6,7 @@ local expect = require("cc.expect").expect
local completion = require("cc.completion") local completion = require("cc.completion")
local help = {} local help = {}
help._DEFAULT_PATH = "/rc/help" help._DEFAULT_PATH = "/leonos/help"
function help.init() function help.init()
local vars = thread.vars() local vars = thread.vars()

View File

@@ -14,7 +14,7 @@ elseif mcver <= 12 or _HOST:match("LeonOS%-PC") then
kmap = "lwjgl2" kmap = "lwjgl2"
end end
local base = dofile("/rc/keymaps/"..kmap..".lua") local base = dofile("/leonos/keymaps/"..kmap..".lua")
local lib = {} local lib = {}
-- reverse-index it! -- reverse-index it!

View File

@@ -32,7 +32,7 @@ function shell.init(env)
copyIfPresent("aliases", vars) copyIfPresent("aliases", vars)
completions[vars.parentShell or 0] = completions[vars.parentShell or 0] or {} 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 vars.env = env or _ENV or _G
end end

View File

@@ -87,7 +87,7 @@ local function redraw()
end end
local syntax = require("edit.syntax") 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 function rehighlight()
local line = {} local line = {}

View File

@@ -22,7 +22,7 @@
-- SOFTWARE. -- SOFTWARE.
-- --
local json = { _version = "0.1.2" } local json = { _version = "0.1.7" }
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
-- Encode -- Encode

View File

@@ -360,7 +360,7 @@ function api.start()
local _native = term.native() local _native = term.native()
wrappedNative = window.create(_native, 1, 1, _native.getSize()) 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") rc.pushEvent("init")

View File

@@ -53,6 +53,6 @@ function nEnv.os.version()
return "LeonOS 1.0 ALpha 1" return "LeonOS 1.0 ALpha 1"
end 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 if not func then error(err, 0) end
func() func()

View File

@@ -23,7 +23,7 @@ local settings = require("settings")
local df = function(f, ...) return assert(loadfile(f))(...) end local df = function(f, ...) return assert(loadfile(f))(...) end
if term.isColor() or settings.get("edit.force_highlight") then if term.isColor() or settings.get("edit.force_highlight") then
df("/rc/editors/advanced.lua", ...) df("/leonos/editors/advanced.lua", ...)
else else
df("/rc/editors/basic.lua", ...) df("/leonos/editors/basic.lua", ...)
end end

View File

@@ -74,32 +74,32 @@ for k, v in pairs(aliases) do
shell.setAlias(k, v) shell.setAlias(k, v)
end end
local completions = "/rc/completions" local completions = "/leonos/completions"
for _, prog in ipairs(fs.list(completions)) do for _, prog in ipairs(fs.list(completions)) do
dofile(fs.combine(completions, prog)) dofile(fs.combine(completions, prog))
end end
local history = {} local history = {}
while true do while true do
if #text > 0 then -- 先清除控制台内容,但保留顶部应用栏
-- 先清除控制台内容,但保留顶部应用栏 local w, h = term.getSize()
local w, h = term.getSize() term.setTextColor(colors.white)
term.setTextColor(colors.white) term.setBackgroundColor(colors.black)
term.setBackgroundColor(colors.black) for y=2, h do
for y=2, h do term.at(1, y).clearLine()
term.at(1, y).clearLine() end
end term.at(1, 2)
term.at(1, 2)
term.setTextColor(colors.yellow)
term.setTextColor(colors.yellow) rc.write("$ "..shell.dir().." >>> ")
rc.write("$ "..shell.dir().." >>> ") term.setTextColor(colors.white)
term.setTextColor(colors.white)
local text = term.read(nil, history, shell.complete) local text = term.read(nil, history, shell.complete)
if #text > 0 then
history[#history+1] = text history[#history+1] = text
local ok, err = shell.run(text) local ok, err = shell.run(text)
if not ok and err then if not ok and err then
io.stderr:write("Application has a error when running and system has stop it. Error:\n", err, "\n") io.stderr:write("Application has a error when running and system has stop it. Error:\n", err, "\n")
end end
end end
end end

View File

@@ -22,7 +22,7 @@ local function expect(...)
end end
-- path resolution: -- 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 -- is; otherwise, resolve the path based on the current program's working
-- directory -- directory
-- this is to allow .OS to run from anywhere -- this is to allow .OS to run from anywhere
@@ -72,8 +72,8 @@ function fs.list(path)
local _, files = pcall(list, path) local _, files = pcall(list, path)
if not _ then return nil, files end if not _ then return nil, files end
if path == "/" then if path == "/" then
-- inject /rc into the root listing -- inject /leonos into the root listing
if not exists("/rc") then if not exists("/leonos") then
files[#files+1] = "rc" files[#files+1] = "rc"
end end
end end

View File

@@ -6,7 +6,7 @@ _G.package = {}
package.config = "/\n;\n?\n!\n-" package.config = "/\n;\n?\n!\n-"
package.cpath = "" 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 function rm(api)
local tab = _G[api] local tab = _G[api]
@@ -76,7 +76,7 @@ package.searchers = {
local fs = package.loaded.fs local fs = package.loaded.fs
-- require isn't here yet -- 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 package.loaded["cc.expect"] = expect
function package.searchpath(name, path, sep, rep) function package.searchpath(name, path, sep, rep)

View File

@@ -1,6 +1,6 @@
-- LeonOS installer -- LeonOS installer
local INSTALLER_VERSION = "0.1.7" local INSTALLER_VERSION = "0.1.7"
local DEFAULT_ROM_DIR = "/rc" local DEFAULT_ROM_DIR = "/leonos"
print("Start loading LeonOS installer...") print("Start loading LeonOS installer...")
print("[Installer] Loading module 1") print("[Installer] Loading module 1")

View File

@@ -4,8 +4,8 @@ local fs = rawget(_G, "fs")
local term = rawget(_G, "term") local term = rawget(_G, "term")
local http = rawget(_G, "http") local http = rawget(_G, "http")
_G._RC_ROM_DIR = _RC_ROM_DIR or "/rc" _G._RC_ROM_DIR = _RC_ROM_DIR or "/leonos"
if _RC_ROM_DIR == "/rom" then _RC_ROM_DIR = "/rc" end if _RC_ROM_DIR == "/rom" then _RC_ROM_DIR = "/leonos" end
-- fail-safe -- fail-safe
local start_rc = [[ local start_rc = [[