Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use a dedicated type for relative paths #252

Closed
2 tasks
casey opened this issue Mar 18, 2020 · 1 comment
Closed
2 tasks

Use a dedicated type for relative paths #252

casey opened this issue Mar 18, 2020 · 1 comment
Labels

Comments

@casey
Copy link
Owner

casey commented Mar 18, 2020

Currently, relative path and paths passed as arguments are just PathBufs. These paths must be passed to Env::resolve before being used, in order to ensure that they are interpreted relative to the current directory.

I think it might be good to use a dedicated type for these paths, so that we don't accidentally use paths that have not been passed to Env::resolve, and so we can try to print out the paths in error messages that users actually input, instead of printing out absolute paths that they might not recognize.

Fix the torrent create message, which currently uses absolute path for metainfo path. Should be:

$ imdl torrent create --input 9front
[1/3] Searching for files in `9front`...
[2/3] Hashing pieces…
[3/3] Writing metainfo to `9front.torrent`...
  • Fix creation messages
  • Fix verification messages
@casey casey added the reform label Mar 18, 2020
@casey casey added this to the eventually milestone Mar 18, 2020
@casey casey modified the milestones: eventually, 0.1.0 Mar 31, 2020
casey added a commit that referenced this issue Apr 6, 2020
If a user passes `--input foo`, print "Searching `foo` for files…",
instead of the resolved, absolute path to `foo`, since the former is
what the user typed in.

This was way harder, and had way more edge cases, than I thought it would
be!

One takaway, lexical path cleaning is excellent.

Fixes #332 and #252.
casey added a commit that referenced this issue Apr 6, 2020
If a user passes `--input foo`, print "Searching `foo` for files…",
instead of the resolved, absolute path to `foo`, since the former is
what the user typed in.

This was way harder, and had way more edge cases, than I thought it would
be!

One takaway, lexical path cleaning is excellent.

Fixes:
- #252
- #332
casey added a commit that referenced this issue Apr 6, 2020
If a user passes `--input foo`, print "Searching `foo` for files…",
instead of the resolved, absolute path to `foo`, since the former is
what the user typed in.

This was way harder, and had way more edge cases, than I thought it would
be!

One takaway, lexical path cleaning is excellent.

Fixes:
- #252
- #332
casey added a commit that referenced this issue Apr 6, 2020
If a user passes `--input foo`, print "Searching `foo` for files…",
instead of the resolved, absolute path to `foo`, since the former is
what the user typed in.

This was way harder, and had way more edge cases, than I thought it would
be!

One takaway, lexical path cleaning is excellent.

Fixes:
- #252
- #332
@casey
Copy link
Owner Author

casey commented Apr 6, 2020

Fixed / given up on in #334.

@casey casey closed this as completed Apr 6, 2020
casey added a commit that referenced this issue Apr 8, 2020
If a user passes `--input foo`, print "Searching `foo` for files…",
instead of the resolved, absolute path to `foo`, since the former is
what the user typed in.

This was way harder, and had way more edge cases, than I thought it would
be!

One takaway, lexical path cleaning is excellent.

type: changed
fixes:
- #252
- #332
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant