From 00bc7e2cee7050807fe10169769002913957c6b4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Florian=20N=C3=BCcke?= Date: Wed, 27 Apr 2016 23:47:46 +0200 Subject: [PATCH] Added some missing methods to the devfs to avoid programs expecting them to be there breaking (such as df) and ordered them the same way as they are in the Scala filesystem component. --- .../opencomputers/loot/OpenOS/lib/devfs.lua | 66 +++++++++++++------ 1 file changed, 47 insertions(+), 19 deletions(-) diff --git a/src/main/resources/assets/opencomputers/loot/OpenOS/lib/devfs.lua b/src/main/resources/assets/opencomputers/loot/OpenOS/lib/devfs.lua index ae413417f..3291eaf2a 100644 --- a/src/main/resources/assets/opencomputers/loot/OpenOS/lib/devfs.lua +++ b/src/main/resources/assets/opencomputers/loot/OpenOS/lib/devfs.lua @@ -8,6 +8,38 @@ function proxy.getLabel() return "devfs" end +function proxy.setLabel(value) + error("drive does not support labeling") +end + +function proxy.isReadOnly() + return false +end + +function proxy.spaceTotal() + return 0 +end + +function proxy.spaceUsed() + return 0 +end + +function proxy.exists(path) + return not not proxy.points[path] +end + +function proxy.size(path) + return 0 +end + +function proxy.isDirectory(path) + return false +end + +function proxy.lastModified(path) + return fs.lastModified("/dev/") +end + function proxy.list() local keys = {} for k,v in pairs(proxy.points) do @@ -16,8 +48,8 @@ function proxy.list() return keys end -function proxy.exists(path) - return not not proxy.points[path] +function proxy.makeDirectory(path) + return false end function proxy.remove(path) @@ -26,26 +58,10 @@ function proxy.remove(path) return true end -function proxy.isDirectory(path) +function proxy.rename(from, to) return false end -function proxy.size(path) - return 0 -end - -function proxy.lastModified(path) - return fs.lastModified("/dev/") -end - -function proxy.read(h,...) - return h:read(...) -end - -function proxy.write(h,...) - return h:write(...) -end - proxy.close = nop function proxy.open(path, mode) @@ -69,6 +85,18 @@ function proxy.open(path, mode) return handle end +function proxy.read(h,...) + return h:read(...) +end + +function proxy.seek(h,...) + return h:seek(...) +end + +function proxy.write(h,...) + return h:write(...) +end + function proxy.create(path, handle) handle.close = handle.close or nop proxy.points[path] = handle