This standard will specify a common path format, similar to other formats, that is not very difficult to implement, primarily so you don't have to write out your entire path format in the documentation, and instead you can just link to this.
I'm not sure if there's already a format for this, but this is probably easier to understand.
A path is considered to be a list of segments seperated by path seperators. It can also start or end with path seperators.
A path seperator is either \
or /
, as in, both work. When emmitting output, it is reccomended that you add an option to
change the output path seperator, but the default should be a forward slash /
.
There are three different types of path segments:
* Empty: Path segments that are exclusively whitespace characters.
Path segments with no contents are empty as there is no non-whitespace characters.
A whitespace character is one of the following:
* a newline `\n`
* a tab `\t`
* a carridge return `\r`
* a space ` `
* Current Directory: This is a path segment that exclusively consists of the content `.`.
* Backup: This is a path segment that exclusively consists of the content `..`.
* Default: Anything else
To resolve a path into one with only default segments, run the following algorithm:
- Let the output be an empty array of strings
- Iterate through all the segments
- If the segment is empty or a current directory do nothing
- If you encounter a backup, pop the item from the top of the output
- If you encounter a default, push the path segment to the output array
You have now resolved the path.