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
.dll
file for your platform. - Copy that file to
garrysmod/lua/bin
of your server.
- Install premake5
- Use
premake5
followed by your platform (vs2015
for windows,gmake
for linux). - Navigate to the
project
folder. - If on Windows, open the
.sln
file, in on Linux, runmake
. - The compiled binary should be in the
gmsv_file/bin
folder.
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)