diff options
| author | Bruce Hill <bruce@bruce-hill.com> | 2025-03-30 15:20:53 -0400 |
|---|---|---|
| committer | Bruce Hill <bruce@bruce-hill.com> | 2025-03-30 15:20:53 -0400 |
| commit | 50bc9f42d5658818347b50f452445f5bcdb7c75d (patch) | |
| tree | ea9291e4c91681d0434d60e0fda282605067bdb8 /src/stdlib | |
| parent | 67f088689019bfc3c731f8157e50c560fabddb04 (diff) | |
Fix some relative path stuff
Diffstat (limited to 'src/stdlib')
| -rw-r--r-- | src/stdlib/paths.c | 7 | ||||
| -rw-r--r-- | src/stdlib/paths.h | 1 |
2 files changed, 8 insertions, 0 deletions
diff --git a/src/stdlib/paths.c b/src/stdlib/paths.c index 7f881c00..c7b560b9 100644 --- a/src/stdlib/paths.c +++ b/src/stdlib/paths.c @@ -710,6 +710,13 @@ public Array_t Path$glob(Path_t path) return glob_files; } +public Path_t Path$current_dir(void) +{ + char cwd[PATH_MAX]; + getcwd(cwd, sizeof(cwd)); + return Path$from_str(cwd); +} + public PUREFUNC uint64_t Path$hash(const void *obj, const TypeInfo_t *type) { (void)type; diff --git a/src/stdlib/paths.h b/src/stdlib/paths.h index 8bdbb2f3..02afc494 100644 --- a/src/stdlib/paths.h +++ b/src/stdlib/paths.h @@ -53,6 +53,7 @@ Text_t Path$base_name(Path_t path); Text_t Path$extension(Path_t path, bool full); Path_t Path$with_component(Path_t path, Text_t component); Path_t Path$with_extension(Path_t path, Text_t extension, bool replace); +Path_t Path$current_dir(void); Closure_t Path$by_line(Path_t path); Array_t Path$glob(Path_t path); |
