From 1db7ac7139adf505be12308fd7ba2920f5beecde Mon Sep 17 00:00:00 2001 From: Nat Goodspeed <nat@lindenlab.com> Date: Tue, 6 Jun 2023 10:02:57 -0400 Subject: [PATCH] SL-18837: Make NamedTempFile name template compatible with Python. The recommended template uses hyphens; change to underscores to be valid Python temp module names. --- indra/test/namedtempfile.h | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/indra/test/namedtempfile.h b/indra/test/namedtempfile.h index 84b62a09457..8cd6c990dc5 100644 --- a/indra/test/namedtempfile.h +++ b/indra/test/namedtempfile.h @@ -83,8 +83,9 @@ class NamedTempFile: public boost::noncopyable { // Create file in a temporary place. boost::filesystem::path tempname{ boost::filesystem::temp_directory_path() }; - // unique_path() recommended model - tempname += stringize(pfx, "%%%%-%%%%-%%%%-%%%%", sfx); + // unique_path() recommended template, but with underscores instead of + // hyphens: some use cases involve temporary Python scripts + tempname += stringize(pfx, "%%%%_%%%%_%%%%_%%%%", sfx); mPath = boost::filesystem::unique_path(tempname); boost::filesystem::ofstream out{ mPath }; -- GitLab