Skip to content
Snippets Groups Projects
Commit 1db7ac71 authored by Nat Goodspeed's avatar Nat Goodspeed
Browse files

SL-18837: Make NamedTempFile name template compatible with Python.

The recommended template uses hyphens; change to underscores to be valid
Python temp module names.
parent 6516c9d0
No related branches found
No related tags found
2 merge requests!3Update to main branch,!2Rebase onto current main branch
......@@ -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 };
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment