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

Allow shell style environment variable access for paths. #4

Open
2 tasks done
HannahFantasia opened this issue Jul 10, 2024 · 5 comments
Open
2 tasks done

Allow shell style environment variable access for paths. #4

HannahFantasia opened this issue Jul 10, 2024 · 5 comments
Labels
community Issues and PRs coming from the community members

Comments

@HannahFantasia
Copy link

Is there an existing issue for this?

  • I have searched the existing issues.

Please describe the feature you have in mind and explain what the current shortcomings are?

Currently I would like to add this path within my executables inside ayon+settings://applications/applications/blender/variants/3/executables/linux/0:
/home/$USER/opt/blender_launcher/custom/Blender_Sandbox/blender

The AYON launcher does not seem to support that.
It naturally does support this:
/home/hannah/opt/blender_launcher/custom/Blender_Sandbox/blender

How would you imagine the implementation of the feature?

I would like to be able to use environment variables in OSes that have folders on user-level to ensure the path towards the directory of the executable can be developed based per individual.

I was considering f strings but that is too risky, tokens were given as an advice instead by my mentor:

/home/{$USER}/opt/blender_launcher/custom/Blender_Sandbox/blender

That would mean the instructions given are in the back-end. Leaving it still as easy for adaptation in the current situation.

Are there any labels you wish to add?

  • I have added the relevant labels to the enhancement request.

Describe alternatives you've considered:

No response

Additional context:

No response

@MustafaJafar
Copy link
Contributor

MustafaJafar commented Jul 11, 2024

@iLLiCiTiT
Should this issue be transferred to ayon-core since it has ayon_core.lib.find_executable which doesn't support template keys, e.g. {username} or environment variables e.g. USERNAME?

@iLLiCiTiT
Copy link
Member

iLLiCiTiT commented Jul 11, 2024

This is for ayon-applications.

@iLLiCiTiT iLLiCiTiT transferred this issue from ynput/ayon-launcher Jul 11, 2024
@MustafaJafar MustafaJafar added the community Issues and PRs coming from the community members label Jul 25, 2024
@BigRoy
Copy link
Contributor

BigRoy commented Jul 25, 2024

It would just mean adding a os.path.expandvars somewhere, right?
And os.path.expanduser if we also want to support the starting ~ (tilde) to indicate the user's home path.

If anyone can point to where it roughly should be I'm sure @HannahFantasia can implement and test her use cases and PR back.

@iLLiCiTiT
Copy link
Member

You can use /home/{USER}/opt/blender_launcher/custom/Blender_Sandbox/blender (no dollar sign).

@BigRoy
Copy link
Contributor

BigRoy commented Oct 8, 2024

You can use /home/{USER}/opt/blender_launcher/custom/Blender_Sandbox/blender (no dollar sign).

Technically the user path is not required to be in /home - right? So ~ expansion may still be nice?
Also, ~ expansion also works on windows at the same time - it's directly cross platform (and may for example for some not live on C:\ drive)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
community Issues and PRs coming from the community members
Projects
None yet
Development

No branches or pull requests

4 participants