Formatting Paths

This page will go over how to format folder/file paths in Reyveld.

Making folder paths for different platforms at once can be tricky, so Reyveld tries to make paths easier for developers by having a few path formatting features to make sure your logic works on every platform.

Formatting

Rule 1: Never Use Absolute Paths

Incorrect

Correct

Rule 2: No backslashes.

Incorrect

Correct

Environment Variables

Windows, Linux, and MacOS all have their own way of accessing environment variables, and if want to port Reyveld to more than just those three platforms, we need a universal way of representing variables.

So, I decided to use colons to act as our universal way of expressing variables, as it is not a valid character on most platforms.

Incorrect

Correct

Platform Tags

There are many cases when we may want a different path for a specific platform, however we would need to write logic to do so. Platform tags an easy alternative.

Structure

<[platform identifier here]>'[path-to]'

Every tag takes a unique three letter identifier to represent a specific platform, and a string right after.

Example

/// win stands for 'Windows'.
<win>'path-to-something'

You can even have different versions for each platform.

Example

<win>'path-to-something'<lix>'path-to-something-else'

If you need a fallback on other platforms, use the any identifier.

Example

/// 'any' must always come after every other platform.
<win>'path-to-something'<any>'path-to-something-else'

You can even have one string for multiple identifiers.

Example

/// Use a comma to seperate each identifier.
<win,lix>'path-to-something'

Last updated