mirror of
https://github.com/CCLeonOS/LeonOS.git
synced 2026-03-03 15:17:01 +00:00
refactor: 将默认路径从/leonos更改为/rc
修改多个文件中的默认路径变量,将/leonos统一替换为/rc,以简化路径命名并保持一致性
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
_G._HOST = _G._HOST .. " (LeonOS 0.1.5)"
|
||||
local fs = rawget(_G, "fs")
|
||||
|
||||
_G._RC_ROM_DIR = _RC_ROM_DIR or (...) and fs.exists("/leonos") and "/leonos" or "/rom"
|
||||
_G._RC_ROM_DIR = _RC_ROM_DIR or (...) and fs.exists("/rc") and "/rc" or "/rom"
|
||||
|
||||
if fs.exists("/.start_rc.lua") and not (...) then
|
||||
_G._RC_USED_START = true
|
||||
|
||||
@@ -6,7 +6,7 @@ local expect = require("cc.expect").expect
|
||||
local completion = require("cc.completion")
|
||||
|
||||
local help = {}
|
||||
help._DEFAULT_PATH = "/leonos/help"
|
||||
help._DEFAULT_PATH = "/rc/help"
|
||||
|
||||
function help.init()
|
||||
local vars = thread.vars()
|
||||
|
||||
@@ -14,7 +14,7 @@ elseif mcver <= 12 or _HOST:match("LeonOS%-PC") then
|
||||
kmap = "lwjgl2"
|
||||
end
|
||||
|
||||
local base = dofile("/leonos/keymaps/"..kmap..".lua")
|
||||
local base = dofile("/rc/keymaps/"..kmap..".lua")
|
||||
local lib = {}
|
||||
|
||||
-- reverse-index it!
|
||||
|
||||
@@ -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 ".:/leonos/programs"
|
||||
vars.path = vars.path or ".:/rc/programs"
|
||||
vars.env = env or _ENV or _G
|
||||
end
|
||||
|
||||
|
||||
@@ -87,7 +87,7 @@ local function redraw()
|
||||
end
|
||||
|
||||
local syntax = require("edit.syntax")
|
||||
.new("/leonos/modules/main/edit/syntax/lua.lua")
|
||||
.new("/rc/modules/main/edit/syntax/lua.lua")
|
||||
|
||||
local function rehighlight()
|
||||
local line = {}
|
||||
|
||||
@@ -360,7 +360,7 @@ function api.start()
|
||||
|
||||
local _native = term.native()
|
||||
wrappedNative = window.create(_native, 1, 1, _native.getSize())
|
||||
api.launchTab("/leonos/programs/shell.lua", "shell")
|
||||
api.launchTab("/rc/programs/shell.lua", "shell")
|
||||
|
||||
rc.pushEvent("init")
|
||||
|
||||
|
||||
@@ -53,6 +53,6 @@ function nEnv.os.version()
|
||||
return "LeonOS 1.0 ALpha 1"
|
||||
end
|
||||
|
||||
local func, err = loadfile("/leonos/programs/shell.lua", "t", nEnv)
|
||||
local func, err = loadfile("/rc/programs/shell.lua", "t", nEnv)
|
||||
if not func then error(err, 0) end
|
||||
func()
|
||||
|
||||
@@ -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("/leonos/editors/advanced.lua", ...)
|
||||
df("/rc/editors/advanced.lua", ...)
|
||||
else
|
||||
df("/leonos/editors/basic.lua", ...)
|
||||
df("/rc/editors/basic.lua", ...)
|
||||
end
|
||||
|
||||
@@ -74,7 +74,7 @@ for k, v in pairs(aliases) do
|
||||
shell.setAlias(k, v)
|
||||
end
|
||||
|
||||
local completions = "/leonos/completions"
|
||||
local completions = "/rc/completions"
|
||||
for _, prog in ipairs(fs.list(completions)) do
|
||||
dofile(fs.combine(completions, prog))
|
||||
end
|
||||
|
||||
@@ -22,7 +22,7 @@ local function expect(...)
|
||||
end
|
||||
|
||||
-- path resolution:
|
||||
-- if the path begins with /leonos, then redirect to wherever that actually
|
||||
-- if the path begins with /rc, 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 /leonos into the root listing
|
||||
if not exists("/leonos") then
|
||||
-- inject /rc into the root listing
|
||||
if not exists("/rc") then
|
||||
files[#files+1] = "rc"
|
||||
end
|
||||
end
|
||||
|
||||
@@ -6,7 +6,7 @@ _G.package = {}
|
||||
|
||||
package.config = "/\n;\n?\n!\n-"
|
||||
package.cpath = ""
|
||||
package.path = "/leonos/apis/?.lua;/leonos/modules/main/?.lua;./lib/?.lua;./lib/?/init.lua;./?.lua;./?/init.lua"
|
||||
package.path = "/rc/apis/?.lua;/rc/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("/leonos/modules/main/cc/expect.lua")()
|
||||
local expect = loadfile("/rc/modules/main/cc/expect.lua")()
|
||||
package.loaded["cc.expect"] = expect
|
||||
|
||||
function package.searchpath(name, path, sep, rep)
|
||||
|
||||
Reference in New Issue
Block a user