Skip to content

Commit e6d181e

Browse files
committed
feat: add path handling requirement
Paths can be a source of confusion/annoyances especially when sharing across operating systems. Therefore, explicit requirements are set. Signed-off-by: JP-Ellis <josh@jpellis.me>
1 parent 847928f commit e6d181e

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

rfc/0000-configuration-and-shared-files.md

+15
Original file line numberDiff line numberDiff line change
@@ -222,6 +222,21 @@ The following tables are proposed:
222222
enable_other_feature = false
223223
```
224224

225+
#### Path Handling
226+
227+
To ensure a uniform experience across the Pact ecosystem and operating systems, the following rules _must_ be followed when handling paths in the configuration file:
228+
229+
- Paths _must_ be stored using the forward slash (`/`) as the path separator.
230+
- This avoids the need to escape backslashes (`\`) in Windows paths.
231+
- If a backslash is used, it is undefined behaviour. The implementation _may_ attempt to convert the backslashes to forward slashes, or may use the value as-is.
232+
- The tilde (`~`) character _must_ be expanded to the user's home directory if it is the first character in a path.
233+
- For example, parsing `~/.local/share/pact` should result in `/home/user/.local/share/pact` on Unix-like systems.
234+
- If the tilde appears elsewhere in the path, it is treated as a literal character.
235+
- If someone wishes to use a literal tilde for a relative path, they _must_ use `./~` instead.
236+
- Relative paths are allowed, and _must_ be resolved relative to the configuration file.
237+
- For example, if the configuration file is located at `/workdir/project/.pact.toml`, and a value is set to `.pact/data`, the resolved path should be `/workdir/project/.pact/data`.
238+
239+
225240
### Shared Files
226241

227242
At present, there are only a few files which are shared across the Pact ecosystem. These are:

0 commit comments

Comments
 (0)