v1.7.2 - Fixed a bug with ls and shell working directory handling.
This commit is contained in:
+1
-1
@@ -1,7 +1,7 @@
|
|||||||
local agcfg = {
|
local agcfg = {
|
||||||
["halyde"] = {
|
["halyde"] = {
|
||||||
["maindir"] = "",
|
["maindir"] = "",
|
||||||
["version"] = "1.7.1",
|
["version"] = "1.7.2",
|
||||||
["description"] = "A universal, customizable and feature-packed operating system for OpenComputers.",
|
["description"] = "A universal, customizable and feature-packed operating system for OpenComputers.",
|
||||||
["directories"] = {
|
["directories"] = {
|
||||||
"halyde/apps",
|
"halyde/apps",
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ Ahalyde/core/
|
|||||||
Ahalyde/config/
|
Ahalyde/config/
|
||||||
Ahalyde/apps/helpdb/
|
Ahalyde/apps/helpdb/
|
||||||
Ahalyde/apps/
|
Ahalyde/apps/
|
||||||
V1.7.1
|
V1.7.2
|
||||||
Ainit.lua
|
Ainit.lua
|
||||||
Ahalyde/apps/helpdb/cat.txt
|
Ahalyde/apps/helpdb/cat.txt
|
||||||
Ahalyde/apps/helpdb/cd.txt
|
Ahalyde/apps/helpdb/cd.txt
|
||||||
|
|||||||
+3
-6
@@ -9,10 +9,7 @@ local fileTable = {}
|
|||||||
|
|
||||||
if target then
|
if target then
|
||||||
if target:sub(1, 1) ~= "/" then
|
if target:sub(1, 1) ~= "/" then
|
||||||
target = shell.workingDirectory .. target
|
target = fs.concat(shell.workingDirectory, target)
|
||||||
end
|
|
||||||
if target:sub(-1, -1) ~= "/" then
|
|
||||||
target = target .. "/"
|
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
target = shell.workingDirectory
|
target = shell.workingDirectory
|
||||||
@@ -45,7 +42,7 @@ if files then
|
|||||||
for _, file in ipairs(files) do
|
for _, file in ipairs(files) do
|
||||||
local dir = false
|
local dir = false
|
||||||
local filetext
|
local filetext
|
||||||
if file:sub(-1, -1) == "/" then -- i think this is a more efficient way to check if it's a directory
|
if file:sub(-1, -1) == "/" then
|
||||||
dir = true
|
dir = true
|
||||||
filetext = "\27[93m"..file:sub(1, -2)
|
filetext = "\27[93m"..file:sub(1, -2)
|
||||||
elseif file:find(".") and file:match("[^.]+$") == "lua" then
|
elseif file:find(".") and file:match("[^.]+$") == "lua" then
|
||||||
@@ -55,7 +52,7 @@ if files then
|
|||||||
if dir then
|
if dir then
|
||||||
print(filetext.." \27[0m[DIR]")
|
print(filetext.." \27[0m[DIR]")
|
||||||
else
|
else
|
||||||
local size = fs.size(target .. file)
|
local size = fs.size(fs.concat(target, file))
|
||||||
local sizeString
|
local sizeString
|
||||||
if convert(size, "B", "GiB") >= 1 then
|
if convert(size, "B", "GiB") >= 1 then
|
||||||
sizeString = tostring(math.floor(convert(size, "B", "GiB") * 100 + 0.5) / 100).." GiB"
|
sizeString = tostring(math.floor(convert(size, "B", "GiB") * 100 + 0.5) / 100).." GiB"
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
local loadfile = ...
|
local loadfile = ...
|
||||||
local filesystem = loadfile("/halyde/lib/filesystem.lua")(loadfile)
|
local filesystem = loadfile("/halyde/lib/filesystem.lua")(loadfile)
|
||||||
|
|
||||||
_G._OSVERSION = "Halyde 1.7.1"
|
_G._OSVERSION = "Halyde 1.7.2"
|
||||||
_G._OSLOGO = ""
|
_G._OSLOGO = ""
|
||||||
local handle, tmpdata = filesystem.open("/halyde/config/oslogo.ans", "r"), nil
|
local handle, tmpdata = filesystem.open("/halyde/config/oslogo.ans", "r"), nil
|
||||||
repeat
|
repeat
|
||||||
|
|||||||
@@ -93,6 +93,9 @@ while true do
|
|||||||
--print(shellcfg["prompt"]:format(shell.workingDirectory),false)
|
--print(shellcfg["prompt"]:format(shell.workingDirectory),false)
|
||||||
-- termlib.cursorPosX = #(shell.workingDirectory .. " > ")
|
-- termlib.cursorPosX = #(shell.workingDirectory .. " > ")
|
||||||
-- termlib.cursorPosY = termlib.cursorPosY - 1
|
-- termlib.cursorPosY = termlib.cursorPosY - 1
|
||||||
|
if shell.workingDirectory:sub(-1, -1) ~= "/" then
|
||||||
|
shell.workingDirectory = shell.workingDirectory .. "/"
|
||||||
|
end
|
||||||
local shellCommand = read("shell", shellcfg.prompt:format(shell.workingDirectory))
|
local shellCommand = read("shell", shellcfg.prompt:format(shell.workingDirectory))
|
||||||
shell.run(shellCommand)
|
shell.run(shellCommand)
|
||||||
gpu.freeAllBuffers()
|
gpu.freeAllBuffers()
|
||||||
|
|||||||
Reference in New Issue
Block a user