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

Expand ~ if used in path #497

Open
liyier90 opened this issue Oct 22, 2021 · 3 comments
Open

Expand ~ if used in path #497

liyier90 opened this issue Oct 22, 2021 · 3 comments

Comments

@liyier90
Copy link
Contributor

Use expanduser when ~ is detected in paths

@ongtw
Copy link
Contributor

ongtw commented Dec 2, 2021

Pathlib has a Path.home().
Can use this when ~ is detected, instead of expanduser (which is from a diff os package).

@liyier90
Copy link
Contributor Author

liyier90 commented Dec 2, 2021

I was thinking of Path.expanduser() to just apply to config variables during the Node init, something like self.input_dir = Path(self.input_dir).expanduser().

The problem I'm having with this is deciding which paths we can apply this to, i.e., which path variables is allowed to accept full paths

@ongtw
Copy link
Contributor

ongtw commented Dec 2, 2021

It is tricky to reconcile different OS/platforms due to different conventions, e.g. ~ / $HOME on Unix/Linux/MacOS, %homepath% / %userprofile% on Windows. Throw in the different shells, local vs network mounted user folder, etc., and the considerations become longer.

One option is to not support any of them, so that we:

  1. don't appear to be platform biased by supporting either.
  2. don't have to expand resources maintaining an exhaustive list of home variables.
  3. avoid creating unintended bugs due to an unforeseen setup.

Stick with status quo where the user would have to specify the complete pathname: this is good since it is unambiguous.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants