diff --git a/README.md b/README.md index 512f828..396b621 100644 --- a/README.md +++ b/README.md @@ -7,6 +7,7 @@ - Keep to folders that are available on all operating systems ## API + ```zig pub const KnownFolder = enum { home, @@ -42,7 +43,31 @@ pub fn open(allocator: std.mem.Allocator, folder: KnownFolder, args: std.fs.Dir. pub fn getPath(allocator: std.mem.Allocator, folder: KnownFolder) Error!?[]const u8; ``` +## Installation + +Initialize a `zig build` project if you haven't already. + +```bash +zig init +``` + +Add the `known-folders` package to your `build.zig.zon`. + +```bash +zig fetch --save git+https://github.com/ziglibs/known-folders.git +``` + +You can then import `known-folders` in your `build.zig` with: + +```zig +const known_folders = b.dependency("known-folders", .{}).module("known-folders"); +const exe = b.addExecutable(...); +// This adds the known-folders module to the executable which can then be imported with `@import("known-folders")` +exe.root_module.addImport("known-folders", known_folders); +``` + ## Configuration + In your root file, add something like this to configure known-folders: ```zig