@@ -384,6 +384,7 @@ def prepare_and_start_backend(
384384 root_service_folder = Path (root_service_folder )
385385 native_folder = root_service_folder / "Native"
386386 cad_integration_folder = root_service_folder / "CADIntegration"
387+ cad_integration_folder_bin = cad_integration_folder / "bin"
387388 schema_folder = root_service_folder / "Schema"
388389
389390 # Adapt the native folder to the OS
@@ -421,15 +422,20 @@ def prepare_and_start_backend(
421422 else :
422423 env_copy ["LICENSE_SERVER" ] = os .getenv ("ANSYSLMD_LICENSE_FILE" , "1055@localhost" )
423424
424- if os .name == "nt" :
425- # Modify the PATH variable to include the path to the Ansys Geometry Core Service
426- env_copy ["PATH" ] = (
427- f"{ env_copy ['PATH' ]} "
428- + f";{ root_service_folder .as_posix ()} "
429- + f";{ native_folder .as_posix ()} "
430- + f";{ cad_integration_folder .as_posix ()} "
431- )
425+ # Adapt the path environment variable to the OS and
426+ # modify the PATH/LD_LIBRARY_PATH variable to include the path
427+ # to the Ansys Geometry Core Service
428+ path_env_var = "PATH" if os .name == "nt" else "LD_LIBRARY_PATH"
429+ env_copy [path_env_var ] = os .pathsep .join (
430+ [
431+ root_service_folder .as_posix (),
432+ native_folder .as_posix (),
433+ cad_integration_folder_bin .as_posix (),
434+ env_copy .get (path_env_var , "" ),
435+ ]
436+ )
432437
438+ if os .name == "nt" :
433439 # For Windows, we need to use the exe file to launch the Core Geometry Service
434440 args .append (
435441 Path (
@@ -456,14 +462,6 @@ def prepare_and_start_backend(
456462 "Please install a compatible version."
457463 )
458464
459- # Modify the LD_LIBRARY_PATH variable to include the Ansys Geometry Core Service
460- env_copy ["LD_LIBRARY_PATH" ] = (
461- env_copy .get ("LD_LIBRARY_PATH" , "" )
462- + f":{ root_service_folder .as_posix ()} "
463- + f":{ native_folder .as_posix ()} "
464- + f":{ cad_integration_folder .as_posix ()} "
465- )
466-
467465 # For Linux, we need to use the dotnet command to launch the Core Geometry Service
468466 args .append ("dotnet" )
469467 args .append (
0 commit comments