|
25 | 25 | from __future__ import annotations |
26 | 26 |
|
27 | 27 | import os |
28 | | -from pathlib import Path, PurePath |
| 28 | +from pathlib import Path, PurePosixPath, PureWindowsPath |
29 | 29 | import traceback |
30 | 30 | from typing import TYPE_CHECKING, Union |
31 | 31 | import warnings |
@@ -159,7 +159,7 @@ def set_result_file_path( |
159 | 159 | ['...tmp...file.rst'] |
160 | 160 |
|
161 | 161 | """ |
162 | | - filepath = Path(filepath) if not isinstance(filepath, PurePath) else filepath |
| 162 | + filepath = PurePosixPath(filepath) if self._server.os=='posix' else PureWindowsPath(filepath) |
163 | 163 | extension = filepath.suffix |
164 | 164 | # Handle .res files from CFX |
165 | 165 | if key == "" and extension == ".res": |
@@ -290,7 +290,7 @@ def set_domain_result_file_path( |
290 | 290 | >>> my_data_sources.set_domain_result_file_path(path='/tmp/file1.rst', key='rst', domain_id=1) |
291 | 291 |
|
292 | 292 | """ |
293 | | - path = Path(path) if not isinstance(path, PurePath) else path |
| 293 | + path = PurePosixPath(path) if self._server.os=='posix' else PureWindowsPath(path) |
294 | 294 | if key: |
295 | 295 | self._api.data_sources_set_domain_result_file_path_with_key_utf8( |
296 | 296 | self, str(path), key, domain_id |
@@ -341,7 +341,7 @@ def add_file_path( |
341 | 341 | # The filename needs to be a fully qualified file name |
342 | 342 | # if not os.path.dirname(filepath) |
343 | 343 |
|
344 | | - filepath = Path(filepath) if not isinstance(filepath, PurePath) else filepath |
| 344 | + filepath = PurePosixPath(filepath) if self._server.os=='posix' else PureWindowsPath(filepath) |
345 | 345 | if not filepath.parent.name: |
346 | 346 | # append local path |
347 | 347 | filepath = Path.cwd() / filepath.name |
@@ -391,7 +391,7 @@ def add_domain_file_path( |
391 | 391 |
|
392 | 392 | """ |
393 | 393 | # The filename needs to be a fully qualified file name |
394 | | - filepath = Path(filepath) if not isinstance(filepath, PurePath) else filepath |
| 394 | + filepath = PurePosixPath(filepath) if self._server.os=='posix' else PureWindowsPath(filepath) |
395 | 395 | if not filepath.parent.name: |
396 | 396 | # append local path |
397 | 397 | filepath = Path.cwd() / filepath.name |
@@ -424,7 +424,7 @@ def add_file_path_for_specified_result( |
424 | 424 | The default is ``""``, in which case the key is found directly. |
425 | 425 | """ |
426 | 426 | # The filename needs to be a fully qualified file name |
427 | | - filepath = Path(filepath) if not isinstance(filepath, PurePath) else filepath |
| 427 | + filepath = PurePosixPath(filepath) if self._server.os=='posix' else PureWindowsPath(filepath) |
428 | 428 | if not filepath.parent.name: |
429 | 429 | # append local path |
430 | 430 | filepath = Path.cwd() / filepath.name |
|
0 commit comments