Skip to content
New issue

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

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

Already on GitHub? # to your account

os.expandTilde "~user" support #24655

Open
litlighilit opened this issue Jan 29, 2025 · 1 comment · May be fixed by #24656
Open

os.expandTilde "~user" support #24655

litlighilit opened this issue Jan 29, 2025 · 1 comment · May be fixed by #24656

Comments

@litlighilit
Copy link
Contributor

litlighilit commented Jan 29, 2025

Summary

os.expandTilde may support "~user", in addition to path beginning with "~"

Description

Python's os.path.expanduser support both '~' and '~user'

And there's a TODO in source code of os.expandTilde:

    # TODO: handle `~bob` and `~bob/` which means home of bob

Also, if ~user cannot be replaced, the path will be returned AS-IS.

Alternatives

No response

Examples

import std/os
echo os.expandTilde("~root")

Backwards Compatibility

This is an expansion to the previous procedure.

A few path that didn't be expanded will be.

Links

https://docs.python.org/3/library/os.path.html#os.path.expanduser

A todo in issue #8177 make extractFilename("~bob") work

@litlighilit
Copy link
Contributor Author

I'm working on it.

Mostly done, just testing.

litlighilit added a commit to litlighilit/Nim that referenced this issue Jan 29, 2025
@ringabout ringabout linked a pull request Feb 3, 2025 that will close this issue
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant