Skip to content

Commit 88b4755

Browse files
committed
fix #43: expander can handle pathsep
1 parent 9ee1f41 commit 88b4755

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

expander.py

+8-7
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
import sys
55
import argparse
66
from logging import Logger, basicConfig, getLogger
7-
from os import getenv, environ
7+
from os import getenv, environ, pathsep
88
from pathlib import Path
99
from typing import List, Set, Optional
1010

@@ -84,13 +84,14 @@ def expand(self, source: str) -> str:
8484
parser.add_argument('--lib', help='Path to Atcoder Library')
8585
opts = parser.parse_args()
8686

87-
lib_path = Path.cwd()
87+
lib_paths = []
8888
if opts.lib:
89-
lib_path = Path(opts.lib)
90-
elif 'CPLUS_INCLUDE_PATH' in environ:
91-
lib_path = Path(environ['CPLUS_INCLUDE_PATH'])
92-
93-
expander = Expander([lib_path])
89+
lib_paths.append(Path(opts.lib))
90+
if 'CPLUS_INCLUDE_PATH' in environ:
91+
lib_paths.extend(
92+
map(Path, filter(None, environ['CPLUS_INCLUDE_PATH'].split(pathsep))))
93+
lib_paths.append(Path.cwd())
94+
expander = Expander(lib_paths)
9495
source = open(opts.source).read()
9596
output = expander.expand(source)
9697

0 commit comments

Comments
 (0)