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

Update get_cache_folder for Windows #90

Merged
merged 2 commits into from
Sep 19, 2022
Merged

Update get_cache_folder for Windows #90

merged 2 commits into from
Sep 19, 2022

Conversation

BramVanroy
Copy link
Contributor

Currently, the get_cache_folder utility tries to rely on the env HOME. But this variable is not regularly set on Windows. Luckily Python comes with some cross-platform defaults to get a user's home directory.

This PR makes a small update to use pathlib's Path.home, which in turn will access os.path.expanduser. Here, the user's home will be resolved. It will target the HOME env variable if it exists (as was implemented in COMET before) and otherwise it will try to find the user's home another way.

This should make the code base more compatible with Windows, although I have not tested yet if this would make the whole lib work on Windows.

Bram Vanroy added 2 commits September 16, 2022 10:39
no need to explicit look for HOME env, because behind the scenes Path.home() will call os.path.expanduser, which will look for HOME env if it exists
@ricardorei ricardorei merged commit d4a7a64 into Unbabel:master Sep 19, 2022
@BramVanroy BramVanroy deleted the download_utils_windows branch September 19, 2022 09:03
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

Successfully merging this pull request may close these issues.

None yet

2 participants