ansys / ansys-tools-path

Library to detect Ansys products installation path
https://path.tools.docs.pyansys.com/
MIT License
3 stars 2 forks source link

support any application with save-ansys-path #164

Closed koubaa closed 4 months ago

koubaa commented 4 months ago

Allow saving any path, not just well-known paths using ansys-tools-path. I want to use this for another program that doesn't belong to any installation (it uses a portable install) and has no version number (it is versioned independently from the likes of mapdl, mechanical, etc).

Obviously the features to find the location and get the version of the application would not work, but I just want to use save-ansys-path to store it and to get the path in the python client of that other program.

I tested this locally using 7zip, like this:

$ save-ansys-path --name=7z "C:\path\to\7-Zip\7zG.exe"
$ python
>>> from ansys.tools.path.path import _get_application_path
>>> _get_application_path("7z")
'C:\\path\\to\\7-Zip\\7zG.exe'

As an implementation detail, I added a simple plugin-system for the "supported" applications (dyna, mapdl, mechanical). I didn't migrate much there, but I think we should move app-specific code there for better maintenance going forwards.