Standard library path resolution for Luma compiler.
More...
#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <pwd.h>
#include <unistd.h>
Go to the source code of this file.
|
| bool | resolve_std_path (const char *import_path, char *buffer, size_t buffer_size) |
| | Resolve a std/ import path to an actual file path.
|
| |
| bool | get_system_std_path (char *buffer, size_t buffer_size) |
| | Get the system-wide Luma standard library path.
|
| |
| bool | get_user_std_path (char *buffer, size_t buffer_size) |
| | Get the user-local Luma standard library path.
|
| |
| bool | file_exists (const char *path) |
| | Check if a file exists at the given path.
|
| |
| const char * | normalize_std_import (const char *path) |
| | Normalize a path by removing "std/" prefix if present.
|
| |
| void | print_std_search_paths (void) |
| |
Standard library path resolution for Luma compiler.
Resolves std/ imports by checking multiple locations:
- System-wide: /usr/local/lib/luma/std/ or C:\Program Files\luma\std\
- User-local: ~/.luma/std/ or USERPROFILE%.luma\std\
- Current directory: ./std/
◆ PATH_SEPARATOR
| #define PATH_SEPARATOR '/' |
◆ PATH_SEPARATOR_STR
| #define PATH_SEPARATOR_STR "/" |
◆ file_exists()
| bool file_exists |
( |
const char * |
path | ) |
|
Check if a file exists at the given path.
- Parameters
-
- Returns
- true if file exists, false otherwise
◆ get_system_std_path()
| bool get_system_std_path |
( |
char * |
buffer, |
|
|
size_t |
buffer_size |
|
) |
| |
Get the system-wide Luma standard library path.
- Parameters
-
| buffer | Buffer to store the path |
| buffer_size | Size of the buffer |
- Returns
- true if successful, false otherwise
◆ get_user_std_path()
| bool get_user_std_path |
( |
char * |
buffer, |
|
|
size_t |
buffer_size |
|
) |
| |
Get the user-local Luma standard library path.
- Parameters
-
| buffer | Buffer to store the path |
| buffer_size | Size of the buffer |
- Returns
- true if successful, false otherwise
◆ normalize_std_import()
| const char * normalize_std_import |
( |
const char * |
path | ) |
|
Normalize a path by removing "std/" prefix if present.
- Parameters
-
- Returns
- Pointer to the normalized path (within the input string)
◆ print_std_search_paths()
| void print_std_search_paths |
( |
void |
| ) |
|
◆ resolve_std_path()
| bool resolve_std_path |
( |
const char * |
import_path, |
|
|
char * |
buffer, |
|
|
size_t |
buffer_size |
|
) |
| |
Resolve a std/ import path to an actual file path.
- Parameters
-
| import_path | The import path (e.g., "std/io" or "std/math") |
| buffer | Buffer to store the resolved path |
| buffer_size | Size of the buffer |
- Returns
- true if the path was resolved successfully, false otherwise