package core:path/slashpath

⌘K
Ctrl+K
or
/

    Overview

    The slashpath package is only to be used for paths separated by forward slashes, e.g. paths in URLs

    This package does not deal with Windows/NT paths with volume letters or backslashes To manipulate operating system specific paths, use the path/filepath package

    Index

    Types (1)
    Constants (0)

    This section is empty.

    Variables (0)

    This section is empty.

    Procedure Groups (0)

    This section is empty.

    Types

    Match_Error ¶

    Match_Error :: enum int {
    	None, 
    	Syntax_Error, 
    }
    Related Procedures With Returns

    Constants

    This section is empty.

    Variables

    This section is empty.

    Procedures

    base ¶

    base :: proc(path: string, new: bool = false, allocator := context.allocator) -> (last_element: string) {…}
     

    base returns the last element of path Trailing slashes are removed If the path is empty, it returns ".". If the path is all slashes, it returns "/"

    clean ¶

    clean :: proc(path: string, allocator := context.allocator) -> string {…}
     

    clean returns the shortest path name equivalent to path through lexical analysis only It applies the following rules iterative until done:

    1) replace multiple slashes with one
    2) remove each . path name element
    3) remove inner .. path name element
    4) remove .. that  begin a rooted path ("/.." becomes "/")
    

    dir ¶

    dir :: proc(path: string, allocator := context.allocator) -> string {…}
     

    dir returns all but the last element of path, typically the path's directory. After dropping the final element using it, the path is cleaned and trailing slashes are removed If the path is empty, it returns "." If the path consists entirely of slashes followed by non-slash bytes, it returns a single slash In any other case, the returned path does not end in a slash

    ext ¶

    ext :: proc(path: string, new: bool = false, allocator := context.allocator) -> string {…}
     

    ext returns the file name extension used by "path". The extension is the suffix beginning at the dot character in the last slash separated element of "path". The path is empty if there is no dot character.

    is_abs ¶

    is_abs :: proc(path: string) -> bool {…}
     

    is_abs checks whether the path is absolute

    is_separator ¶

    is_separator :: proc(c: u8) -> bool {…}
     

    is_separator checks whether the byte is a valid separator character

    join ¶

    join :: proc(elems: []string, allocator := context.allocator) -> string {…}
     

    join joins numerous path elements into a single path

    match ¶

    match :: proc(pattern, name: string) -> (matched: bool, err: Match_Error) {…}
     

    match states whether "name" matches the shell pattern Pattern syntax is:

    pattern:
    	{term}
    term:
    	'*'	        matches any sequence of non-/ characters
    	'?'             matches any single non-/ character
    	'[' ['^']  { character-range } ']'
    	                character classification (cannot be empty)
    	c               matches character c (c != '*', '?', '\\', '[')
    	'\\' c          matches character c
    
    character-range
    	c               matches character c (c != '\\', '-', ']')
    	'\\' c          matches character c
    	lo '-' hi       matches character c for lo <= c <= hi
    
    

    match requires that the pattern matches the entirety of the name, not just a substring The only possible error returned is .Syntax_Error

    name ¶

    name :: proc(path: string, new: bool = false, allocator := context.allocator) -> (name: string) {…}
     

    name returns the file without the base and without the extension

    split ¶

    split :: proc(path: string) -> (dir, file: string) {…}
     

    split splits path immediately following the last slash, separating it into a directory and file name component. If there is no slash in path, it returns an empty dir and file set to path The returned values have the property that path = dir+file

    split_elements ¶

    split_elements :: proc(path: string, allocator := context.allocator) -> []string {…}
     

    split_elements splits the path elements into slices of the original path string

    Procedure Groups

    This section is empty.

    Source Files

    Generation Information

    Generated with odin version dev-2024-04 (vendor "odin") Windows_amd64 @ 2024-04-25 21:10:21.944881400 +0000 UTC