A simple file i/o library for Garry's Mod written in ANSI C.
- Go to the "Releases" of this GitHub repository.
- Download the latest
.dllfile for your platform. - Copy that file to
garrysmod/lua/binof your server.
- Install premake5
- Use
premake5followed by your platform (vs2015for windows,gmakefor linux). - Navigate to the
projectfolder. - If on Windows, open the
.slnfile, in on Linux, runmake. - The compiled binary should be in the
gmsv_file/binfolder.
The module provides barebones functionality for file manipulation. It's being worked on, more features are coming soon!
(All functions are relative to garrysmod/ folder!!)
--- Appends contents at the end of file.
-- @return[Boolean success]
File.append(filename, contents)
--- Deletes file.
-- @return[Boolean success]
File.delete(filename)
--- Creates a folder with specified name.
-- Returns false if the folder exists, or was unable to be created.
-- @return[Boolean success]
File.mkdir(directory)
--- Reads specified file.
-- @return[String contents]
File.read(filename)
--- Writes contents to file. Overwrites existing contents.
-- @return[Boolean success]
File.write(filename, contents)