Create archives of files within Garry's Mod

Overview

gm_zip

Create archives of files within Garry's Mod.

Note: The scope of this module only works accross the gmod installation files e.g from GarrysMod/garrysmod/. Anything out of this scope is not supported.

Examples

Folder archiving:

require("zip")

local delete_original_folder = true
Zip("folder.zip", "path/to/folder", delete_original_folder)

Zip("folder.zip", "path/to/folder2") -- not providing the 3rd argument (or setting it to false) will keep the original folder

Simple file archiving:

require("zip")

Zip("archive.zip", { "lua/send.txt" })

Change the paths in the archive:

require("zip")

Zip("addon_send.zip", {
  { Path = "lua/send.txt", ArchivePath = "send.txt" } -- Path is the real path to the file, ArchivePath is the path used within the archive
})

Advanced file archiving:

require("zip")

local function get_lua_files(res, dir)
    res = res or {}
    dir = dir or "lua"

    local files, dirs = file.Find(dir .. "/*", "MOD")
    for _, f in pairs(files or {}) do
        if not f:EndsWith(".lua") then continue end
        table.insert(res, dir .. "/" .. f)
    end

    for _, d in pairs(dirs or {}) do
        get_lua_files(res, dir .. "/" .. d)
    end

    return res
end

local lua_files = get_lua_files()
Zip("my_lua_files.zip", lua_files)

Compiling

  • open a terminal
  • get git or download the archive for the repository directly
  • git clone https://github.com/Earu/gm_zip (ignore this if you've downloaded the archive)
  • run cd gm_zip
  • install cargo (on windows => https://win.rustup.rs) (on linux/macos => curl https://sh.rustup.rs -sSf | sh)
  • cargo build
  • go in target/debug and rename the binary according to your branch and realm (gmsv_zip_win64, gmcl_zip_win64, gmsv_zip_linux, gmcl_zip_linux, gmcl_zip_osx64)
  • put the binary in your gmod lua/bin directory
You might also like...
Rust command-line tool to encrypt and decrypt files or directories with age

Bottle A Rust command-line tool that can compress and encrypt (and decrypt and extract) files or directories using age, gzip, and tar. Bottle has no c

CLI program written in Rust to anonymize DICOM files

dicom-anonymizer CLI program written in Rust to anonymize DICOM files anonymizer 0.1.0 Domenic Melcher USAGE: anonymizer [OPTIONS] FILE ARGS:

A tool and library to losslessly join multiple .mp4 files shot with same camera and settings

mp4-merge A tool and library to losslessly join multiple .mp4 files shot with same camera and settings. This is useful to merge multiple files that ar

Send Youtube videos as audio podcasts to your personal Pocket Casts files section.

yttopocketcasts Send Youtube videos as audio podcasts to your personal Pocket Casts files section. Quick Start Prerequisites: Docker and Make must be

A simple path traversal checker made with Rust. Useful for APIs that serve dynamic files.

Path trav A simple path traversal checker made with Rust. Useful for APIs that serve dynamic files. Note: this is a security tool. If you see somethin

Generate rust structs & query functions from diesel schema files

dsync A utility to generate database structs and querying code from diesel schema files. Primarily built for create-rust-app. Currently, it's more adv

A tiny service that downloads files over HTTP links, with resume and restart support.
A tiny service that downloads files over HTTP links, with resume and restart support.

Http Drogue Http Drogue is a tiny service that downloads files over HTTP from links you provide. It can restart and resume interrupted downloads. Http

Code sample for "Reading files the hard way Part 3"

read-raw-ext4 Rust code sample to read an ext4 partition from Rust, for: https://fasterthanli.me/series/reading-files-the-hard-way/part-3 Usage Don't.

Convert PNG image files to binary for use with AgonLight (TM)

image2agon Converts PNG files to binary data for AgonLight (TM) usage. This document is for version V1.0 of the program. V1.0 - initial upload NOTE: T

Releases(V1.0.0)
Owner
Earu
Willing to learn and practice the most niche and craziest things to achieve my goals! Analyst programmer. Highly competent with the .NET and Lua stacks.
Earu
Checks Crusader Kings 3 user mod files for common mistakes and warns about them.

ck3-tiger Pounces on bugs. Checks Crusader Kings 3 user mod files for common mistakes and warns about them. For example: missing localizations, or usi

Richard Braakman 8 Jan 5, 2023
Manas project aims to create a modular framework and ecosystem to create robust storage servers adhering to Solid protocol in rust.

मनस् | Manas Solid is a web native protocol to enable interoperable, read-write, collaborative, and decentralized web, truer to web's original vision.

Manomayam 17 Oct 5, 2023
Construct complex structures within single call + simple compile-time meta-inheritance model with mixins.

Introduction constructivism is a Rust sample-library designed to simplify the construction of structured data by defining and manipulating sequences o

polako.rs 5 Oct 24, 2023
Base Garry's Mod binary module (Rust)

gmod-module-base-rs A base for developing Garry's Mod binary modules in Rust. Getting Started Install Rust Download or git clone this repository Open

William 7 Jul 30, 2022
A mod loader for Baldur's Gate 3

Yet-Another-BG3-Mod-Loader This is a native mod loader for Baldur's Gate 3 The main features of this mod loader are: It does not modify any original g

Cherry 3 Oct 17, 2023
Extended Kinect support for Garry's Mod

?? gmcl_rekinect This is a reimplementation of Kinect support for Garry's Mod, allowing you to do stuff like this on more platforms. Features Support

William 3 Dec 17, 2023
Use rust programming language to create a b+ tree.

Use rust programming language to create a b+ tree.

yangshijie 3 Jan 7, 2023
Simple CLI tool to create dummy accounts with referral links to give yourself free Plus.

Free Duolingo Plus A simple CLI tool to create dummy accounts with referral links to give yourself free Plus (max 24/41 weeks depending on whether you

null 23 Apr 27, 2023
My create new project simply (originaly in bash), in rust !

CNPS-Rust CNPS (Create new project simply) is a powerful tool built in Rust that simplifies the process of creating projects in various programming la

Asteroidus 3 Jul 30, 2023
Create custom ID types that are guaranteed to be valid `RecordID` in SurrealDB

surreal-id The surreal-id crate offers a standardized way to create and validate IDs in your application for usage with SurrealDB. Using the NewId tra

Liam Woodleigh-Hardinge 4 Oct 5, 2023