Skip to content

Commit

Permalink
FEAT: Symbolic link removed it (#4957)
Browse files Browse the repository at this point in the history
  • Loading branch information
Samuelopez-ansys authored Jul 29, 2024
1 parent 6505345 commit b0f022b
Showing 1 changed file with 1 addition and 23 deletions.
24 changes: 1 addition & 23 deletions doc/source/Resources/pyaedt_installer_from_aedt.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,35 +75,13 @@ def run_pyinstaller_from_c_python(oDesktop):
if os.path.isdir(pyaedt_path):
break

# Create PyAEDT symbolic link in PersonalLib
personal_lib_dir = oDesktop.GetPersonalLibDirectory()
pers1 = os.path.join(personal_lib_dir, "pyaedt")

if os.path.exists(pers1):
if is_windows:
command = 'rmdir "{}"'.format(pers1)
else:
command = 'rm "{}"'.format(pers1)
ret_code = os.system(command)
if ret_code != 0:
oDesktop.AddMessage("", "", 2,
"Error occurred while removing the symbolic link to PyAEDT in 'PersonalLib'.")

if is_windows:
command = 'mklink /D "{}" "{}"'.format(pers1, pyaedt_path)
else:
command = 'ln -s "{}" "{}"'.format(pyaedt_path, pers1)
ret_code = os.system(command)
if ret_code != 0:
oDesktop.AddMessage("", "", 2, "Error occurred while configuring the symbolic link to PyAEDT in 'PersonalLib'.")

# Create Toolkits in PersonalLib
import tempfile
python_script = os.path.join(tempfile.gettempdir(), "configure_pyaedt.py")
if os.path.isfile(python_script):
os.remove(python_script)
with open(python_script, "w") as f:
# enable in debu mode
# enable in debug mode
# f.write("import sys\n")
# f.write('sys.path.insert(0, r"c:\\ansysdev\\git\\repos\\pyaedt")\n')
f.write("from pyaedt.workflows.installer.pyaedt_installer import add_pyaedt_to_aedt\n")
Expand Down

0 comments on commit b0f022b

Please sign in to comment.