mirror of
https://github.com/MightyPirates/OpenComputers.git
synced 2025-09-14 09:46:53 -04:00
improve /mnt and PS1 conformity
filesystem: don't mount tmpfs in /mnt shell: remove trailing slash for pwd ps1: make the default prompt easier to interpret
This commit is contained in:
parent
1279537f8d
commit
462b264f31
@ -22,7 +22,7 @@ local function onInit()
|
|||||||
end
|
end
|
||||||
|
|
||||||
local function onComponentAdded(_, address, componentType)
|
local function onComponentAdded(_, address, componentType)
|
||||||
if componentType == "filesystem" then
|
if componentType == "filesystem" and require("computer").tmpAddress() ~= address then
|
||||||
local proxy = component.proxy(address)
|
local proxy = component.proxy(address)
|
||||||
if proxy then
|
if proxy then
|
||||||
local name = address:sub(1, 3)
|
local name = address:sub(1, 3)
|
||||||
|
@ -17,7 +17,7 @@ set HOME=/home
|
|||||||
set IFS=\
|
set IFS=\
|
||||||
set MANPATH=/usr/man:.
|
set MANPATH=/usr/man:.
|
||||||
set PAGER=/bin/more
|
set PAGER=/bin/more
|
||||||
set PS1='$PWD# '
|
set PS1='$PWD # '
|
||||||
set PWD=/
|
set PWD=/
|
||||||
set SHELL=/bin/sh
|
set SHELL=/bin/sh
|
||||||
set LS_COLORS="{FILE=0xFFFFFF,DIR=0x66CCFF,LINK=0xFFAA00,['*.lua']=0x00FF00}"
|
set LS_COLORS="{FILE=0xFFFFFF,DIR=0x66CCFF,LINK=0xFFAA00,['*.lua']=0x00FF00}"
|
||||||
|
@ -127,13 +127,15 @@ function shell.resolveAlias(command, args)
|
|||||||
end
|
end
|
||||||
|
|
||||||
function shell.getWorkingDirectory()
|
function shell.getWorkingDirectory()
|
||||||
|
-- if no env PWD default to /
|
||||||
return os.getenv("PWD") or "/"
|
return os.getenv("PWD") or "/"
|
||||||
end
|
end
|
||||||
|
|
||||||
function shell.setWorkingDirectory(dir)
|
function shell.setWorkingDirectory(dir)
|
||||||
checkArg(1, dir, "string")
|
checkArg(1, dir, "string")
|
||||||
dir = fs.canonical(dir) .. "/"
|
-- ensure at least /
|
||||||
if dir == "//" then dir = "/" end
|
-- and remove trailing /
|
||||||
|
dir = fs.canonical(dir):gsub("^$", "/"):gsub("(.)/$", "%1")
|
||||||
if fs.isDirectory(dir) then
|
if fs.isDirectory(dir) then
|
||||||
os.setenv("PWD", dir)
|
os.setenv("PWD", dir)
|
||||||
return true
|
return true
|
||||||
|
Loading…
x
Reference in New Issue
Block a user