Skip to content
This repository was archived by the owner on Nov 17, 2025. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 15 additions & 6 deletions src/ansys/tools/path/__init__.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
"""
tools.
tools to find/cache installed Ansys products.

path
WARNING: This is not concurrent-safe (multiple python processes might race on this data.)
"""

try:
Expand All @@ -14,9 +14,18 @@

from ansys.tools.path.path import (
SUPPORTED_ANSYS_VERSIONS,
change_default_ansys_path,
find_ansys,
get_ansys_path,
change_default_mapdl_path,
change_default_mechanical_path,
find_mapdl,
find_mechanical,
get_available_ansys_installations,
save_ansys_path,
get_mapdl_path,
get_mechanical_path,
save_mapdl_path,
save_mechanical_path,
version_from_path,
)
from ansys.tools.path.path import change_default_ansys_path # deprecated
from ansys.tools.path.path import find_ansys # deprecated
from ansys.tools.path.path import get_ansys_path # deprecated
from ansys.tools.path.path import save_ansys_path # deprecated
25 changes: 25 additions & 0 deletions src/ansys/tools/path/misc.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,32 @@
"""Miscellaneous functions used by ansys-tools-path."""

import os


def is_float(input_string):
"""Returns true when a string can be converted to a float"""
try:
float(input_string)
return True
except ValueError:
return False


def is_windows():
"""Check if the host machine is on Windows.

Returns
-------
``True`` if the host machine is on Windows, ``False`` otherwise.
"""
return os.name == "nt"


def is_linux():
"""Check if the host machine is Linux.

Returns
-------
``True`` if the host machine is Linux, ``False`` otherwise.
"""
return os.name == "posix"
Loading