From 87d7a72d8745a85a51306c7e46e4d936e26828a0 Mon Sep 17 00:00:00 2001 From: Federico Negri Date: Thu, 7 Aug 2025 14:31:19 +0200 Subject: [PATCH 1/2] adjust dt-client download folder --- src/ansys/hps/client/client.py | 36 ++++++++++++---------------------- 1 file changed, 13 insertions(+), 23 deletions(-) diff --git a/src/ansys/hps/client/client.py b/src/ansys/hps/client/client.py index 7be7789ec..51e82217d 100644 --- a/src/ansys/hps/client/client.py +++ b/src/ansys/hps/client/client.py @@ -282,7 +282,7 @@ def initialize_data_transfer_client(self): try: log.info("Starting Data Transfer client.") # start Data transfer client - self._dt_client = DataTransferClient(download_dir=self._get_download_dir("Ansys")) + self._dt_client = DataTransferClient(download_dir=self._get_download_dir()) self._dt_client.binary_config.update( verbosity=3, @@ -299,36 +299,26 @@ def initialize_data_transfer_client(self): log.debug(ex) raise HPSError("Error occurred when starting Data Transfer client.") from ex - def _get_download_dir(self, company=None): + def _get_download_dir(self): r"""Return download directory platform dependent. - :Parameters: - -`company`: Company name of the software provider - Resulting paths: - `Linux`: /home/user/.ansys/binaries - `Windows`: C:\\Users\\user\\AppData\\Local\\Ansys\\binaries + `Linux`: /home/user/.ansys/hps/binaries + `Windows`: C:\\Users\\user\\AppData\\Local\\Ansys\\hps\\binaries Note that on Windows we use AppData\\Local for this, not AppData\\Roaming, as the data stored for an application should typically be kept local. """ - environment_variable = "HOME" - if platform.uname()[0].lower() == "windows": - environment_variable = "LOCALAPPDATA" - path = os.environ.get(environment_variable, None) - - app_dir = "" - if company: - app_dir = os.path.join(app_dir, company) - if app_dir: - if platform.uname()[0].lower() != "windows": - app_dir = "." + app_dir.lower() - path = os.path.join(path, app_dir) - - path = os.path.join(path, "binaries") - - return path + environment_variable = "LOCALAPPDATA" + company_folder = "Ansys" + if platform.uname()[0].lower() != "windows": + environment_variable = "HOME" + company_folder = ".ansys" + + home_path = os.environ.get(environment_variable, None) + + return os.path.join(home_path, company_folder, "hps", "data-transfer", "binaries") @property def auth_api_url(self) -> str: From be9c867a61b115a000b3687eb9b3c9bc41798581 Mon Sep 17 00:00:00 2001 From: Federico Negri Date: Thu, 7 Aug 2025 14:54:13 +0200 Subject: [PATCH 2/2] adjust docstring --- src/ansys/hps/client/client.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/ansys/hps/client/client.py b/src/ansys/hps/client/client.py index 51e82217d..362b008a6 100644 --- a/src/ansys/hps/client/client.py +++ b/src/ansys/hps/client/client.py @@ -303,8 +303,8 @@ def _get_download_dir(self): r"""Return download directory platform dependent. Resulting paths: - `Linux`: /home/user/.ansys/hps/binaries - `Windows`: C:\\Users\\user\\AppData\\Local\\Ansys\\hps\\binaries + `Linux`: /home/user/.ansys/hps/data-transfer/binaries + `Windows`: C:\\Users\\user\\AppData\\Local\\Ansys\\hps\\data-transfer\\binaries Note that on Windows we use AppData\\Local for this, not AppData\\Roaming, as the data stored for an application should typically be kept local.