From 63753c5e8405837931510b8da648dc75d4970fe1 Mon Sep 17 00:00:00 2001
From: madmaxoft
Date: Fri, 22 Nov 2013 20:11:24 +0100
Subject: Added cFile:GetFolderContents().
Fix 162.
---
MCServer/Plugins/APIDump/APIDesc.lua | 21 +++++++++++----------
MCServer/Plugins/Debuggers/Debuggers.lua | 11 +++++++++++
2 files changed, 22 insertions(+), 10 deletions(-)
(limited to 'MCServer/Plugins')
diff --git a/MCServer/Plugins/APIDump/APIDesc.lua b/MCServer/Plugins/APIDump/APIDesc.lua
index 11b0aeff7..8591d9aa4 100644
--- a/MCServer/Plugins/APIDump/APIDesc.lua
+++ b/MCServer/Plugins/APIDump/APIDesc.lua
@@ -927,22 +927,23 @@ end
cFile =
{
Desc = [[
- Provides helper functions for manipulating and querying the filesystem. Most functions are called
- directly on the cFile class itself:
+ Provides helper functions for manipulating and querying the filesystem. Most functions are static,
+ so they should be called directly on the cFile class itself:
cFile:Delete("/usr/bin/virus.exe");
]],
Functions =
{
- Copy = { Params = "SrcFileName, DstFileName", Return = "bool", Notes = "Copies a single file to a new destination. Returns true if successful. Fails if the destination already exists." },
- CreateFolder = { Params = "FolderName", Return = "bool", Notes = "Creates a new folder. Returns true if successful." },
- Delete = { Params = "FileName", Return = "bool", Notes = "Deletes the specified file. Returns true if successful." },
- Exists = { Params = "FileName", Return = "bool", Notes = "Returns true if the specified file exists." },
- GetSize = { Params = "FileName", Return = "number", Notes = "Returns the size of the file, or -1 on failure." },
- IsFile = { Params = "Path", Return = "bool", Notes = "Returns true if the specified path points to an existing file." },
- IsFolder = { Params = "Path", Return = "bool", Notes = "Returns true if the specified path points to an existing folder." },
- Rename = { Params = "OrigPath, NewPath", Return = "bool", Notes = "Renames a file or a folder. Returns true if successful. Undefined result if NewPath already exists." },
+ Copy = { Params = "SrcFileName, DstFileName", Return = "bool", Notes = "(STATIC) Copies a single file to a new destination. Returns true if successful. Fails if the destination already exists." },
+ CreateFolder = { Params = "FolderName", Return = "bool", Notes = "(STATIC) Creates a new folder. Returns true if successful." },
+ Delete = { Params = "FileName", Return = "bool", Notes = "(STATIC) Deletes the specified file. Returns true if successful." },
+ Exists = { Params = "FileName", Return = "bool", Notes = "(STATIC) Returns true if the specified file exists." },
+ GetFolderContents = { Params = "FolderName", Return = "array table of strings", Notes = "(STATIC) Returns the contents of the specified folder, as an array table of strings. Each filesystem object is listed. Use the IsFile() and IsFolder() functions to determine the object type." },
+ GetSize = { Params = "FileName", Return = "number", Notes = "(STATIC) Returns the size of the file, or -1 on failure." },
+ IsFile = { Params = "Path", Return = "bool", Notes = "(STATIC) Returns true if the specified path points to an existing file." },
+ IsFolder = { Params = "Path", Return = "bool", Notes = "(STATIC) Returns true if the specified path points to an existing folder." },
+ Rename = { Params = "OrigPath, NewPath", Return = "bool", Notes = "(STATIC) Renames a file or a folder. Returns true if successful. Undefined result if NewPath already exists." },
},
}, -- cFile
diff --git a/MCServer/Plugins/Debuggers/Debuggers.lua b/MCServer/Plugins/Debuggers/Debuggers.lua
index 682a54676..c9a610f71 100644
--- a/MCServer/Plugins/Debuggers/Debuggers.lua
+++ b/MCServer/Plugins/Debuggers/Debuggers.lua
@@ -51,6 +51,8 @@ function Initialize(Plugin)
PM:BindCommand("/fr", "debuggers", HandleFurnaceRecipe, "- Shows the furnace recipe for the currently held item");
PM:BindCommand("/ff", "debuggers", HandleFurnaceFuel, "- Shows how long the currently held item would burn in a furnace");
+ Plugin:AddWebTab("Debuggers", HandleRequest_Debuggers);
+
-- Enable the following line for BlockArea / Generator interface testing:
-- PluginManager:AddHook(Plugin, cPluginManager.HOOK_CHUNK_GENERATED);
@@ -943,3 +945,12 @@ end
+
+function HandleRequest_Debuggers(a_Request)
+ local FolderContents = cFile:GetFolderContents("./");
+ return "The following objects have been returned by cFile:GetFolderContents():
- " .. table.concat(FolderContents, "
- ") .. "
";
+end
+
+
+
+
--
cgit v1.2.3