• Stars
    star
    218
  • Rank 181,805 (Top 4 %)
  • Language
    Zig
  • License
    MIT License
  • Created over 4 years ago
  • Updated 4 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Provides access to well-known folders across several operating systems

Zig Known Folders Project

Design Goals

  • Minimal API surface
  • Provide the user with an option to either obtain a directory handle or a path name
  • Keep to folders that are available on all operating systems

API

pub const KnownFolder = enum {
    home,
    documents,
    pictures,
    music,
    videos,
    desktop,
    downloads,
    public,
    fonts,
    app_menu,
    cache,
    roaming_configuration,
    local_configuration,
    global_configuration,
    data,
    runtime,
    executable_dir,
};

pub const Error = error{ ParseError, OutOfMemory };

pub const KnownFolderConfig = struct {
    xdg_force_default: bool = false,
    xdg_on_mac: bool = false,
};

/// Returns a directory handle, or, if the folder does not exist, `null`.
pub fn open(allocator: std.mem.Allocator, folder: KnownFolder, args: std.fs.Dir.OpenDirOptions) (std.fs.Dir.OpenError || Error)!?std.fs.Dir;

/// Returns the path to the folder or, if the folder does not exist, `null`.
pub fn getPath(allocator: std.mem.Allocator, folder: KnownFolder) Error!?[]const u8;

Configuration

In your root file, add something like this to configure known-folders:

pub const known_folders_config = .{
    .xdg_on_mac = true,
}

More Repositories

1

zgl

Zig OpenGL Wrapper
Zig
380
star
2

zlm

Zig linear mathemathics
Zig
142
star
3

s2s

A zig binary serialization format.
Zig
117
star
4

positron

A web renderer frontend for zig applications
C++
107
star
5

repository

A community-maintained repository of zig packages
Zig
101
star
6

ansi-term

Zig library for dealing with ANSI terminals
Zig
64
star
7

zinput

A Zig command-line input library!
Zig
47
star
8

zig-lsp

Microsoft's Language Server Protocol implemented in Zig for use in zls and beyond! <3
Zig
44
star
9

tres

ValueTree-based JSON parser
Zig
39
star
10

treez

tree-sitter bindings for Zig
Zig
38
star
11

antiphony

A zig remote procedure call solution
Zig
32
star
12

fontaine

A library to support text rendering in arbitrary contexts
Zig
32
star
13

funzig

Fun functional functionality for Zig!
Zig
30
star
14

zig-lv2

Zig-intuitive bindings for LV2.
Zig
29
star
15

zorm

Lightweight and efficient object-relational mapping
Zig
26
star
16

eggzon

πŸ₯šZon - A DOM based Zig Object Notation parser
Zig
22
star
17

ini

A teeny tiny ini parser
Zig
21
star
18

diffz

Implementation of go-diff's diffmatchpatch in Zig
Zig
19
star
19

painterz

Low-level implementation of different painting primitives (lines, rectangles, ...) without specialization on a certain draw target
Zig
19
star
20

string-searching

String(not limited to []const u8)-searching algorithms in zig
Zig
18
star
21

tree-sitter-zig

Zig tree-sitter grammar
JavaScript
18
star
22

zigfp

Basic fixed point implementation in Zig.
Zig
18
star
23

zCOM

A composable network protocol stack for embedded and desktop.
Zig
15
star
24

lscolors

A zig library for colorizing paths according to LS_COLORS
Zig
14
star
25

computils

Zig utilities for all your comptime needs.
Zig
9
star
26

zig-windows-console

Zig Windows Console stuff
Zig
6
star
27

comptemplate

Comptime Templates
Zig
5
star
28

zwin

Making windows with Zig! (Only works on Windows at the moment)
Zig
4
star
29

zdb

Allocator-free document oriented database management. WIP
Zig
3
star
30

wavefront-obj

A parser for wavefront object files
Zig
2
star
31

package-collector

Collects packages from all over the ziguanity.
Go
2
star
32

uuencode

Unix-To-Unix-Encoding for Zig
Zig
1
star