ynput / ayon-applications

AYON addon to maintain applications
Apache License 2.0
3 stars 4 forks source link

Allow shell style environment variable access for paths. #4

Open HannahFantasia opened 2 months ago

HannahFantasia commented 2 months ago

Is there an existing issue for this?

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?

Describe alternatives you've considered:

No response

Additional context:

No response

MustafaJafar commented 2 months ago

@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 commented 2 months ago

This is for ayon-applications.

BigRoy commented 1 month ago

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.