From 2ff882f239f065585ad1b02f12b191bf99dd6626 Mon Sep 17 00:00:00 2001 From: madmaxoft Date: Wed, 9 Oct 2013 09:38:47 +0200 Subject: Added static cFile functions to Lua API. --- source/OSSupport/File.h | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) (limited to 'source/OSSupport/File.h') diff --git a/source/OSSupport/File.h b/source/OSSupport/File.h index d4ea0d3a8..f47bd4041 100644 --- a/source/OSSupport/File.h +++ b/source/OSSupport/File.h @@ -41,9 +41,14 @@ Usage: +// tolua_begin + class cFile { public: + + // tolua_end + #ifdef _WIN32 static const char PathSeparator = '\\'; #else @@ -90,6 +95,8 @@ public: /// Reads the file from current position till EOF into an AString; returns the number of bytes read or -1 for error int ReadRestOfFile(AString & a_Contents); + // tolua_begin + /// Returns true if the file specified exists static bool Exists(const AString & a_FileName); @@ -99,9 +106,20 @@ public: /// 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); + /// Copies a file, returns true if successful. + static bool Copy(const AString & a_SrcFileName, const AString & a_DstFileName); + /// Returns true if the specified path is a folder static bool IsFolder(const AString & a_Path); + /// Returns true if the specified path is a regular file + static bool IsFile(const AString & a_Path); + + /// Returns the size of the file, or a negative number on error + static int GetSize(const AString & a_FileName); + + // tolua_end + int Printf(const char * a_Fmt, ...); private: @@ -110,7 +128,7 @@ private: #else HANDLE m_File; #endif -} ; +} ; // tolua_export -- cgit v1.2.3