Skip to content

Commit

Permalink
add Installation guide to README
Browse files Browse the repository at this point in the history
  • Loading branch information
Techatrix committed Jul 12, 2024
1 parent ed5f3f9 commit 9a4980c
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
- Keep to folders that are available on all operating systems

## API

```zig
pub const KnownFolder = enum {
home,
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 9a4980c

Please sign in to comment.