diff options
| author | Bruce Hill <bruce@bruce-hill.com> | 2024-09-09 01:14:33 -0400 |
|---|---|---|
| committer | Bruce Hill <bruce@bruce-hill.com> | 2024-09-09 01:14:33 -0400 |
| commit | 11c560ebccfa3eabb939dafc4139be92edd26842 (patch) | |
| tree | 43af12019ce7d133a539a0b3a9388e07e82acec6 /builtins/path.h | |
| parent | 13a9304decb86450a2a0e9cc756da4c2d373c929 (diff) | |
More path stuff including some methods
Diffstat (limited to 'builtins/path.h')
| -rw-r--r-- | builtins/path.h | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/builtins/path.h b/builtins/path.h new file mode 100644 index 00000000..54632d42 --- /dev/null +++ b/builtins/path.h @@ -0,0 +1,35 @@ +#pragma once + +// A lang for filesystem paths + +#include <gc/cord.h> +#include <stdbool.h> +#include <stdint.h> + +#include "types.h" +#include "datatypes.h" + +#define Path_t Text_t +#define Path(text) ((Path_t)Text(text)) +#define Paths(...) ((Path_t)Texts(__VA_ARGS__)) + +Path_t Path$escape_text(Text_t text); +Path_t Path$resolved(Path_t path, Path_t relative_to); +Path_t Path$relative(Path_t path, Path_t relative_to); +bool Path$exists(Path_t path); +bool Path$is_file(Path_t path, bool follow_symlinks); +bool Path$is_directory(Path_t path, bool follow_symlinks); +bool Path$is_pipe(Path_t path, bool follow_symlinks); +bool Path$is_socket(Path_t path, bool follow_symlinks); +bool Path$is_symlink(Path_t path); + +void Path$write(Path_t path, Text_t text, int permissions); +void Path$append(Path_t path, Text_t text, int permissions); +Text_t Path$read(Path_t path); +void Path$remove(Path_t path, bool ignore_missing); +void Path$create_directory(Path_t path, int permissions); + +extern const TypeInfo Path$info; + +// vim: ts=4 sw=0 et cino=L2,l1,(0,W4,m1,\:0 + |
