Skip to content

Commit 28769bf

Browse files
authored
Merge pull request #518 from EvgSkv/main
Catching up ti2023 with main.
2 parents 77aed34 + 23c6e6b commit 28769bf

2 files changed

Lines changed: 6 additions & 3 deletions

File tree

parser_cpp/logica_parse.cpp

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2288,7 +2288,9 @@ static std::vector<std::string> SplitLogicapath(const char* lp) {
22882288
size_t pos = s.find(':', start);
22892289
if (pos == std::string::npos) pos = s.size();
22902290
std::string part = s.substr(start, pos - start);
2291-
if (!part.empty()) roots.push_back(part);
2291+
// Preserve empty segments: in PATH-like variables (and in python's
2292+
// LOGICAPATH parsing), an empty entry means "current directory".
2293+
roots.push_back(part);
22922294
start = pos + 1;
22932295
}
22942296
return roots;
@@ -2413,7 +2415,8 @@ int main(int argc, char** argv) {
24132415
size_t pos = s.find(':', start);
24142416
if (pos == std::string::npos) pos = s.size();
24152417
std::string part = s.substr(start, pos - start);
2416-
if (!part.empty()) import_root.push_back(part);
2418+
// Preserve empty segments (see SplitLogicapath).
2419+
import_root.push_back(part);
24172420
start = pos + 1;
24182421
}
24192422
}

parser_cpp/logica_parse_cpp.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -278,7 +278,7 @@ def _LogicapathFromImportRoot(import_root) -> Optional[str]:
278278
if isinstance(import_root, str):
279279
return import_root
280280
if isinstance(import_root, (list, tuple)):
281-
return ':'.join([str(x) for x in import_root if x])
281+
return ':'.join([str(x) for x in import_root])
282282
raise TypeError('Unexpected import_root type: %r' % (type(import_root),))
283283

284284

0 commit comments

Comments
 (0)