diff --git a/src/main/resources/assets/opencomputers/loot/OpenOS/bin/ls.lua b/src/main/resources/assets/opencomputers/loot/OpenOS/bin/ls.lua index 1583c8a8d..4ddd1360b 100644 --- a/src/main/resources/assets/opencomputers/loot/OpenOS/bin/ls.lua +++ b/src/main/resources/assets/opencomputers/loot/OpenOS/bin/ls.lua @@ -30,7 +30,11 @@ for i = 1, #dirs do local lsf = {} for f in list do if f:sub(-1) == "/" then - table.insert(lsd, f) + if options.p then + table.insert(lsd, f) + else + table.insert(lsd, f:sub(1, -2)) + end else table.insert(lsf, f) end @@ -65,13 +69,14 @@ for i = 1, #dirs do end end setColor(0xFFFFFF) - if options.c then - io.write("\nDirectories: "..tostring(#lsd)) - io.write("\nFiles: "..tostring(#lsf)) + if options.M then + io.write("\n" .. tostring(#lsf) .. " File(s)") + io.write("\n" .. tostring(#lsd) .. " Dir(s)") end if not options.l then io.write("\n") end end end -io.output():setvbuf("no") \ No newline at end of file +io.output():setvbuf("no") +io.output():flush() \ No newline at end of file diff --git a/src/main/resources/assets/opencomputers/loot/OpenOS/usr/man/ls b/src/main/resources/assets/opencomputers/loot/OpenOS/usr/man/ls index c8910c038..1b230fb11 100644 --- a/src/main/resources/assets/opencomputers/loot/OpenOS/usr/man/ls +++ b/src/main/resources/assets/opencomputers/loot/OpenOS/usr/man/ls @@ -12,6 +12,10 @@ OPTIONS do not ignore entries starting with . -l use a long listing format + -p + append / indicator to directories + -M + display Microsoft-style file and directory count after listing EXAMPLES ls diff --git a/src/main/scala/li/cil/oc/util/LuaStateFactory.scala b/src/main/scala/li/cil/oc/util/LuaStateFactory.scala index 535d25d8a..8a5e1a299 100644 --- a/src/main/scala/li/cil/oc/util/LuaStateFactory.scala +++ b/src/main/scala/li/cil/oc/util/LuaStateFactory.scala @@ -103,10 +103,10 @@ object LuaStateFactory { // If the file, already exists, make sure it's the same we need, if it's // not disable use of the natives. if (file.exists()) { + var matching = true try { val inCurrent = libraryUrl.openStream() val inExisting = new FileInputStream(file) - var matching = true var inCurrentByte = 0 var inExistingByte = 0 do {