Skip to content

Commit 6c12206

Browse files
committed
doc: modified another src file
1 parent a05896a commit 6c12206

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

src/ansys/dpf/core/misc.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
import glob
2727
import os
2828
import re
29+
from pathlib import Path
2930

3031
from pkgutil import iter_modules
3132
from ansys.dpf.core import errors
@@ -120,7 +121,7 @@ def get_ansys_path(ansys_path=None):
120121
'- or by setting it by default with the environment variable "ANSYS_DPF_PATH"'
121122
)
122123
# parse the version to an int and check for supported
123-
ansys_folder_name = str(ansys_path).split(os.sep)[-1]
124+
ansys_folder_name = Path(ansys_path).parts[-1]
124125
reobj_vXYZ = re.compile("^v[0123456789]{3}$")
125126
if reobj_vXYZ.match(ansys_folder_name):
126127
# vXYZ Unified Install folder
@@ -171,18 +172,18 @@ def find_ansys():
171172

172173
base_path = None
173174
if os.name == "nt":
174-
base_path = os.path.join(os.environ["PROGRAMFILES"], "ANSYS INC")
175+
base_path = Path(os.environ["PROGRAMFILES"]) / "ANSYS INC"
175176
elif os.name == "posix":
176-
for path in ["/usr/ansys_inc", "/ansys_inc"]:
177-
if os.path.isdir(path):
177+
for path in [Path("/usr/ansys_inc"), Path("/ansys_inc")]:
178+
if path.is_dir():
178179
base_path = path
179180
else:
180181
raise OSError(f"Unsupported OS {os.name}")
181182

182183
if base_path is None:
183184
return base_path
184185

185-
paths = glob.glob(os.path.join(base_path, "v*"))
186+
paths = glob.glob(str(base_path / "v*"))
186187

187188
if not paths:
188189
return None

0 commit comments

Comments
 (0)