|
HikoGUI
A low latency retained GUI
|
Files | |
| file | glob.hpp |
| Defines utilities for handling glob patterns. | |
| file | path_location.hpp |
| functions to locate files and directories. | |
This module contains file handling utilities:
path_location, get_paths(), find_path() to find files and directories on the system.glob_pattern, glob() to find files and directories based on a glob pattern.URI, URL for managing URLs for local and remote resources.The path-locations functions are used to find files and directories based on the context of the operating system, the user account and application.
For example fonts are located in multiple places:
To iterate over all the font directories:
To find the first matching file in one of the font directories:
To find files based on a pattern using wild cards like * you can use the glob utilities.
The constructor of the glob_pattern object parses a string or std::filesystem::path which contain one or more of the following tokens:
| Token | Description |
|---|---|
| foo | Matches the text "foo". |
| ? | Matches any single character except '/'. |
| [abcd] | Matches a single character that is 'a', 'b', 'c' or 'd'. |
| [a-d] | Matches a single character that is 'a', 'b', 'c' or 'd'. |
| [-a-d] | Matches a single character that is '-', 'a', 'b', 'c' or 'd'. |
| {foo,bar,baz} | Matches the text "foo", "bar" or "baz". |
| * | Matches zero or more character except '/'. |
| /**/ | Matches one or more directories. A single slash or zero or more characters between two slashes. |
Then the glob() function will search for files and directories matching this pattern. glob() is also overloaded to directly parse a pattern and combine it with path_location.
For example to find all the files in the font directories:
The URI, URL and URN terms can be confusing, here is a short explanation.
HikoGUI currently implements dereferencing of the following types of URLs:
resource_dirs().Both file: and resource: URLs may be implicitly converted to a std::filesystem::path.