• Stars
    star
    190
  • Rank 196,821 (Top 4 %)
  • Language
    Zig
  • License
    MIT License
  • Created almost 4 years ago
  • Updated 3 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
312
star
2

s2s

A zig binary serialization format.
Zig
109
star
3

zlm

Zig linear mathemathics
Zig
109
star
4

positron

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

repository

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

ansi-term

Zig library for dealing with ANSI terminals
Zig
51
star
7

zinput

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

zig-lsp

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

tres

ValueTree-based JSON parser
Zig
39
star
10

fontaine

A library to support text rendering in arbitrary contexts
Zig
33
star
11

zig-lv2

Zig-intuitive bindings for LV2.
Zig
30
star
12

antiphony

A zig remote procedure call solution
Zig
26
star
13

treez

tree-sitter bindings for Zig
Zig
26
star
14

zorm

Lightweight and efficient object-relational mapping
Zig
25
star
15

funzig

Fun functional functionality for Zig!
Zig
25
star
16

eggzon

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

painterz

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

ini

A teeny tiny ini parser
Zig
17
star
19

tree-sitter-zig

Zig tree-sitter grammar
JavaScript
16
star
20

zigfp

Basic fixed point implementation in Zig.
Zig
16
star
21

string-searching

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

diffz

Implementation of go-diff's diffmatchpatch in Zig
Zig
15
star
23

zCOM

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

lscolors

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

computils

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

zig-windows-console

Zig Windows Console stuff
Zig
5
star
27

comptemplate

Comptime Templates
Zig
5
star
28

zdb

Allocator-free document oriented database management. WIP
Zig
4
star
29

zwin

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

package-collector

Collects packages from all over the ziguanity.
Go
3
star
31

uuencode

Unix-To-Unix-Encoding for Zig
Zig
2
star
32

wavefront-obj

A parser for wavefront object files
Zig
2
star