package core:path/filepath
Overview
Process paths using either forward slashes or backslashes depending on the operating system. To process paths such as URLs that depend on forward slashes regardless of the OS, use the slashpath package.
Index
Types (2)
Constants (4)
Variables (0)
This section is empty.
Procedure Groups (2)
Types
Relative_Error ¶
Relative_Error :: enum int { None, Cannot_Relate, }
Related Procedures With Returns
Constants
LIST_SEPARATOR ¶
LIST_SEPARATOR :: ';'
SEPARATOR ¶
SEPARATOR :: '\\'
SEPARATOR_CHARS ¶
SEPARATOR_CHARS :: `/\`
SEPARATOR_STRING ¶
SEPARATOR_STRING :: `\`
Variables
This section is empty.
Procedures
abs ¶
abs :: proc(path: string, allocator := context.allocator) -> (absolute_path: string, error: os.Error) {…}
Get the absolute path to path with respect to the process's current directory.
Allocates Using Provided Allocator
clean ¶
clean :: proc(path: string, allocator := context.allocator) -> (cleaned: string, err: runtime.Allocator_Error) {…}
Returns the shortest path name equivalent to path through solely lexical processing.
It applies the folliwng rules until none of them can be applied:
* Replace multiple separators with a single one
* Remove each current directory (.) path name element
* Remove each inner parent directory (..) path and the preceding paths
* Remove .. that begin at the root of a path
* All possible separators are replaced with the OS specific separator
The return path ends in a slash only if it represents the root of a directory (C:\ on Windows and / on *nix systems).
If the result of the path is an empty string, the returned path with be ".".
join ¶
join :: proc(elems: []string, allocator := context.allocator) -> (joined: string, err: runtime.Allocator_Error) {…}
Join all elems with the system's path separator and normalize the result.
Allocates Using Provided Allocator
For example, join_path({"/home", "foo", "bar.txt"}) will result in "/home/foo/bar.txt".
rel ¶
rel :: proc(base_path, target_path: string, allocator := context.allocator) -> (string, Relative_Error) {…}
Returns a relative path that is lexically equivalent to the target_path when joined with the base_path with an OS specific separator.
e.g. join(base_path, rel(base_path, target_path)) is equivalent to target_path
On failure, the Relative_Error will be state it cannot compute the necessary relative path.
replace_separators ¶
replace_separators :: proc(path: string, new_sep: rune, allocator := context.allocator) -> (new_path: string, err: os.Error) {…}
Returns the result of replacing each path separator character in the path
with the specific character new_sep.
Allocates Using Provided Allocator
Procedure Groups
walker_create ¶
walker_create :: proc{ os.walker_create_path, os.walker_create_file, }
Creates a walker, either using a path or a file pointer to a directory the walker will start at.
For an example on how to use the walker, see walker_walk.
walker_init ¶
walker_init :: proc{ os.walker_init_path, os.walker_init_file, }
Initializes a walker, either using a path or a file pointer to a directory the walker will start at.
You are allowed to repeatedly call this to reuse it for later walks.
For an example on how to use the walker, see walker_walk.
Source Files
- match.odin
- path.odin
- walk.odin
- (hidden platform specific files)
Generation Information
Generated with odin version dev-2026-04 (vendor "odin") Windows_amd64 @ 2026-04-27 21:46:25.309311400 +0000 UTC