Skip to content

Commit

Permalink
escape eidos
Browse files Browse the repository at this point in the history
  • Loading branch information
petrelharp committed Jul 6, 2024
1 parent e141024 commit 5b89040
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions stdpopsim/slim_engine.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,12 @@

logger = logging.getLogger(__name__)


def _escape_eidos(s):
# this is for Windows paths passed as strings in Eidos
return "\\\\".join(s.split("\\"))


_slim_upper = """
initialize() {
if (!exists("dry_run"))
Expand Down Expand Up @@ -1171,7 +1177,7 @@ def fix_time(event):
recombination_rates=recomb_rates_str,
recombination_ends=recomb_ends_str,
generation_time=demographic_model.generation_time,
trees_file=trees_file,
trees_file=_escape_eidos(trees_file),
pop_names=f"c({pop_names_str})",
)
)
Expand Down Expand Up @@ -1489,7 +1495,7 @@ def matrix2str(
if logfile is not None:
printsc(
string.Template(_slim_logfile).substitute(
logfile=logfile,
logfile=_escape_eidos(str(logfile)),
loginterval=logfile_interval,
)
)
Expand Down

0 comments on commit 5b89040

Please sign in to comment.