File tree Expand file tree Collapse file tree 1 file changed +6
-5
lines changed Expand file tree Collapse file tree 1 file changed +6
-5
lines changed Original file line number Diff line number Diff line change 2626import glob
2727import os
2828import re
29+ from pathlib import Path
2930
3031from pkgutil import iter_modules
3132from 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
You can’t perform that action at this time.
0 commit comments