Luma 0.1.0
A low-level compiled alternative to C, C++, and more!
Loading...
Searching...
No Matches
std_path.h
Go to the documentation of this file.
1
11#pragma once
12
13#include <stdbool.h>
14#include <stdio.h>
15#include <stdlib.h>
16#include <string.h>
17
18#if defined(__MINGW32__) || defined(_WIN32)
19#include <shlobj.h>
20#include <windows.h>
21#define PATH_SEPARATOR '\\'
22#define PATH_SEPARATOR_STR "\\"
23#else
24#include <pwd.h>
25#include <unistd.h>
26#define PATH_SEPARATOR '/'
27#define PATH_SEPARATOR_STR "/"
28#endif
29
38bool resolve_std_path(const char *import_path, char *buffer,
39 size_t buffer_size);
40
48bool get_system_std_path(char *buffer, size_t buffer_size);
49
57bool get_user_std_path(char *buffer, size_t buffer_size);
58
65bool file_exists(const char *path);
66
73const char *normalize_std_import(const char *path);
74void print_std_search_paths(void);
bool get_user_std_path(char *buffer, size_t buffer_size)
Get the user-local Luma standard library path.
Definition std_path.c:39
const char * normalize_std_import(const char *path)
Normalize a path by removing "std/" prefix if present.
Definition std_path.c:13
bool get_system_std_path(char *buffer, size_t buffer_size)
Get the system-wide Luma standard library path.
Definition std_path.c:24
bool resolve_std_path(const char *import_path, char *buffer, size_t buffer_size)
Resolve a std/ import path to an actual file path.
Definition std_path.c:65
void print_std_search_paths(void)
Definition std_path.c:132
bool file_exists(const char *path)
Check if a file exists at the given path.
Definition std_path.c:3