From 34f716beaa87ea064b6b8e10bb9af24248394573 Mon Sep 17 00:00:00 2001 From: TheWahlolly Date: Thu, 29 May 2025 16:26:07 +0300 Subject: [PATCH] v1.7.2 - Fixed a bug with ls and shell working directory handling. --- argentum.cfg | 2 +- argentum/store/halyde/package.cfg | 2 +- halyde/apps/ls.lua | 9 +++------ halyde/core/boot.lua | 2 +- halyde/core/shell.lua | 3 +++ 5 files changed, 9 insertions(+), 9 deletions(-) diff --git a/argentum.cfg b/argentum.cfg index 5fb3839..ddf468d 100644 --- a/argentum.cfg +++ b/argentum.cfg @@ -1,7 +1,7 @@ local agcfg = { ["halyde"] = { ["maindir"] = "", - ["version"] = "1.7.1", + ["version"] = "1.7.2", ["description"] = "A universal, customizable and feature-packed operating system for OpenComputers.", ["directories"] = { "halyde/apps", diff --git a/argentum/store/halyde/package.cfg b/argentum/store/halyde/package.cfg index 8d969cc..cc5c601 100644 --- a/argentum/store/halyde/package.cfg +++ b/argentum/store/halyde/package.cfg @@ -4,7 +4,7 @@ Ahalyde/core/ Ahalyde/config/ Ahalyde/apps/helpdb/ Ahalyde/apps/ -V1.7.1 +V1.7.2 Ainit.lua Ahalyde/apps/helpdb/cat.txt Ahalyde/apps/helpdb/cd.txt diff --git a/halyde/apps/ls.lua b/halyde/apps/ls.lua index f3a68ff..eafb80d 100644 --- a/halyde/apps/ls.lua +++ b/halyde/apps/ls.lua @@ -9,10 +9,7 @@ local fileTable = {} if target then if target:sub(1, 1) ~= "/" then - target = shell.workingDirectory .. target - end - if target:sub(-1, -1) ~= "/" then - target = target .. "/" + target = fs.concat(shell.workingDirectory, target) end else target = shell.workingDirectory @@ -45,7 +42,7 @@ if files then for _, file in ipairs(files) do local dir = false 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 filetext = "\27[93m"..file:sub(1, -2) elseif file:find(".") and file:match("[^.]+$") == "lua" then @@ -55,7 +52,7 @@ if files then if dir then print(filetext.." \27[0m[DIR]") else - local size = fs.size(target .. file) + local size = fs.size(fs.concat(target, file)) local sizeString if convert(size, "B", "GiB") >= 1 then sizeString = tostring(math.floor(convert(size, "B", "GiB") * 100 + 0.5) / 100).." GiB" diff --git a/halyde/core/boot.lua b/halyde/core/boot.lua index 0bd2f71..436e139 100644 --- a/halyde/core/boot.lua +++ b/halyde/core/boot.lua @@ -1,7 +1,7 @@ local loadfile = ... local filesystem = loadfile("/halyde/lib/filesystem.lua")(loadfile) -_G._OSVERSION = "Halyde 1.7.1" +_G._OSVERSION = "Halyde 1.7.2" _G._OSLOGO = "" local handle, tmpdata = filesystem.open("/halyde/config/oslogo.ans", "r"), nil repeat diff --git a/halyde/core/shell.lua b/halyde/core/shell.lua index fbda683..f4a9f8d 100644 --- a/halyde/core/shell.lua +++ b/halyde/core/shell.lua @@ -93,6 +93,9 @@ while true do --print(shellcfg["prompt"]:format(shell.workingDirectory),false) -- termlib.cursorPosX = #(shell.workingDirectory .. " > ") -- 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)) shell.run(shellCommand) gpu.freeAllBuffers()