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

%HOMEPATH% does not contain the drive name #211

Closed
2 tasks done
dokempf opened this issue May 16, 2024 · 4 comments · Fixed by #212
Closed
2 tasks done

%HOMEPATH% does not contain the drive name #211

dokempf opened this issue May 16, 2024 · 4 comments · Fixed by #212
Assignees
Labels
type::bug describes erroneous operation, use severity::* to classify the type

Comments

@dokempf
Copy link

dokempf commented May 16, 2024

Checklist

  • I added a descriptive title
  • I searched open reports and couldn't find a duplicate

What happened?

In the absence of the working_dir key, on Windows, menuinst uses %HOMEPATH% as the default. However, I have stumbled over this on a system, where the home was not on the C: drive. In order to also get the drive, one would need to use %HOMEDRIVE%. When googling to find a solution, I also stumbled over a number of reports that these two variables may not be set in some circumstances.

I would therefore suggest to maybe use %USERPROFILE% for that purpose. Apparently, it is always set to a full path.

Conda Info

No response

Conda Config

No response

Conda list

No response

Additional Context

No response

@dokempf dokempf added the type::bug describes erroneous operation, use severity::* to classify the type label May 16, 2024
@github-project-automation github-project-automation bot moved this to 🆕 New in 🧭 Planning May 16, 2024
@marcoesters
Copy link
Contributor

marcoesters commented May 16, 2024

There are two (not mutually exclusive) ways to go about this:

  • We change the default to either %USERPROFILE% or %HOMEDRIVE%%HOMEPATH%
  • We render environment variables in working_dir

I think the latter should definitely be done. Whether %USERPROFILE%, which I think is %SYSTEMDRIVE%\Users\%USERNAME%, or %HOMEDRIVE%%HOMEPATH% is the better default, I'm not quite sure yet.

I do think we should definitely implement the second point though. In that case, you could set working_dir to %USERPROFILE% in your recipe and it would work.

@marcoesters marcoesters self-assigned this May 16, 2024
@dokempf
Copy link
Author

dokempf commented May 16, 2024

I do think we should definitely implement the second point though. In that case, you could set working_dir to %USERPROFILE% in your recipe and it would work.

Wouldn't that work anyway? The rendering is delayed until execution, but Windows then does it. At least, that is what I manually tested by manipulating the shortcut.

If you want me to contribute a PR here, please let me know.

@marcoesters
Copy link
Contributor

For the execution, yes, but looking at this issue, I found a small bug that creates and unwanted directory : https://github.com/conda/menuinst/blob/main/menuinst/platforms/win.py#L161-L162

I think from what I'm reading %HOMEDRIVE%%HOMEPATH% is what's the "canonical" home directory and I am currently thinking that this should stay the default. You are right though that %HOMEDRIVE% needs to be added.

If you want me to contribute a PR here, please let me know.

You are welcome to do so if you have the time. I just assigned the issue to myself to fix it, but I'm happy to have you take over. Just let me know so we don't interfere with each other.

@dokempf
Copy link
Author

dokempf commented May 16, 2024

If you're on it already, it sure is more efficient for you to do it. I just wanted to express my willingness to contribute.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type::bug describes erroneous operation, use severity::* to classify the type
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

2 participants