core/path/slashpath

slashpath

Types

1

Procedures

11

base

base :: proc(path: string, new: untyped boolean = false, allocator: mem.Allocator = context.allocator) -> (last_element: string)Source

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: mem.Allocator = context.allocator) -> (string)Source

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: mem.Allocator = context.allocator) -> (string)Source

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: untyped boolean = false, allocator: mem.Allocator = context.allocator) -> (string)Source

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.

join

join :: proc(elems: []string, allocator: mem.Allocator = context.allocator) -> (string)Source

join joins numerous path elements into a single path

match

match :: proc(pattern: string, name: string) -> (matched: bool, err: Match_Error)Source

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: untyped boolean = false, allocator: mem.Allocator = context.allocator) -> (name: string)Source

name returns the file without the base and without the extension

split

split :: proc(path: string) -> (dir: string, file: string)Source

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

Reference search

Find anything

Documentation preferences

Settings

System theme variants

Used only while Theme is set to System.