Skip to content

Commit 32d515a

Browse files
lainmelainmekhsrali
authored
Fix: use platform-specific separator for AIIDA_PATH in config directory detection (#6935)
Previously, the configuration directory lookup split the AIIDA_PATH environment variable using a hardcoded ':' separator, which caused issues on Windows systems where ';' is used as the path separator. This update introduces platform detection using sys.platform to select the correct separator for splitting paths, ensuring compatibility across operating systems. --------- Co-authored-by: lainme <[email protected]> Co-authored-by: Ali Khosravi <[email protected]>
1 parent da3e425 commit 32d515a

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

src/aiida/manage/configuration/settings.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212

1313
import os
1414
import pathlib
15+
import sys
1516
import warnings
1617
from typing import final
1718

@@ -132,9 +133,15 @@ def _get_configuration_directory_from_envvar() -> pathlib.Path | None:
132133
if environment_variable is None:
133134
return None
134135

136+
# Determine seperator to split paths in environment variables like PATH
137+
if sys.platform == 'win32':
138+
seperator = ';'
139+
else:
140+
seperator = ':'
141+
135142
# Loop over all the paths in the ``AIIDA_PATH`` variable to see if any of them contain a configuration folder
136143
dirpath_config = None
137-
for base_dir_path in [path for path in environment_variable.split(':') if path]:
144+
for base_dir_path in [path for path in environment_variable.split(seperator) if path]:
138145
dirpath_config = pathlib.Path(base_dir_path).expanduser()
139146

140147
# Only add the base config directory name to the base path if it does not already do so

0 commit comments

Comments
 (0)