From 9fc35514e64657f08929894c4ea4142daa81052d Mon Sep 17 00:00:00 2001 From: madmaxoft Date: Wed, 9 Oct 2013 11:31:38 +0200 Subject: [PATCH] APIDump: Documented the new cFile API functions. --- MCServer/Plugins/APIDump/APIDesc.lua | 24 ++++++++++++++++++++++++ source/OSSupport/File.h | 4 ++-- 2 files changed, 26 insertions(+), 2 deletions(-) diff --git a/MCServer/Plugins/APIDump/APIDesc.lua b/MCServer/Plugins/APIDump/APIDesc.lua index 7bef7bcfd..c41cac51b 100644 --- a/MCServer/Plugins/APIDump/APIDesc.lua +++ b/MCServer/Plugins/APIDump/APIDesc.lua @@ -841,6 +841,30 @@ World:ForEachChestInChunk(Player:GetChunkX(), Player:GetChunkZ(), }, }, + cFile = + { + Desc = [[ + Provides helper functions for manipulating and querying the filesystem. Most functions are 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." }, + }, + + }, + cFireChargeEntity = { Desc = "", diff --git a/source/OSSupport/File.h b/source/OSSupport/File.h index 9fef25ace..cfb3a2019 100644 --- a/source/OSSupport/File.h +++ b/source/OSSupport/File.h @@ -103,8 +103,8 @@ public: /// Deletes a file, returns true if successful static bool Delete(const AString & a_FileName); - /// Renames a file, returns true if successful. May fail if dest already exists (libc-dependant)! - static bool Rename(const AString & a_OrigFileName, const AString & a_NewFileName); + /// Renames a file or folder, returns true if successful. May fail if dest already exists (libc-dependant)! + static bool Rename(const AString & a_OrigPath, const AString & a_NewPath); /// Copies a file, returns true if successful. static bool Copy(const AString & a_SrcFileName, const AString & a_DstFileName);