end2endzone / ShellAnything

ShellAnything is a C++ open-source software which allow one to easily customize and add new options to *Windows Explorer* context menu. Define specific actions when a user right-click on a file or a directory.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Set a property value from a search in the PATH environment variable

end2endzone opened this issue · comments

Is your feature request related to a problem? Please describe.
It would be useful to be able to set a property based on a search in the PATH environment variable.

Describe the solution you'd like
A searchpath property should be added to the <property> element.

<property name="python.exe.path" searchpath="python.exe" />

Describe alternatives you've considered
N/A

Additional context
This feature would allow people to detect software that are already available on the system. For example, software that are "portable" do not require installation and cannot be easily detected from the registry or other means. Other software installs in a non standards directory such as C:\Program Files\. To be easily available on the system, they might add their main executable to the PATH environment variable.

For example, python executable is not always installed in the same directory. For example, the executable for version 3.10.0 installed in directory C:\Users\MyUserName\AppData\Local\Programs\Python\Python310\python.exe. The issue is that you cannot predict the directory Python310 to be identical for all users. The installer properly configures the PATH environment variable to so that python,exe can be found on the system. The property should search for a file named python.exe within all elements of PATH environment variable. The file path of the first result should be set as the property value.

An advanced use case would be to define a Python (or any other software) Configuration File that can be easily shared across multiple users.

<?xml version="1.0" encoding="utf-8"?>
<root>
  <shell>
    <default>
      <!-- Detect Python executable on the system -->
      <property name="python.exe.path" searchpath="python.exe" />
    </default>

    <menu name="Python">
      <visibility properties="python.exe.path" />

      <menu name="Print version">
        <actions>
          <exec ... />
        </actions>
      </menu>

      <menu name="Run">
  	<visibility maxfiles="1" maxfolders="0" fileextensions="py" />
        <actions>
          <exec ... />
        </actions>
      </menu>

    </menu>
  </shell>
</root>