[PATCH 3/3] rld-process: Add named tempfile constructor
Alex White
alexanderjwhite at gmail.com
Wed Mar 3 17:01:54 UTC 2021
This adds a new tempfile constructor for creating a named tempfile
rather than generating the name.
---
rtemstoolkit/rld-process.cpp | 11 +++++++++++
rtemstoolkit/rld-process.h | 7 +++++++
2 files changed, 18 insertions(+)
diff --git a/rtemstoolkit/rld-process.cpp b/rtemstoolkit/rld-process.cpp
index 30e0605..4160759 100644
--- a/rtemstoolkit/rld-process.cpp
+++ b/rtemstoolkit/rld-process.cpp
@@ -169,6 +169,17 @@ namespace rld
_name = temporaries.get (suffix, _keep);
}
+ tempfile::tempfile (const std::string& name,
+ const std::string& suffix,
+ bool _keep)
+ : _name(name + suffix),
+ suffix(suffix),
+ overridden (false),
+ fd (-1),
+ level (0)
+ {
+ }
+
tempfile::~tempfile ()
{
try
diff --git a/rtemstoolkit/rld-process.h b/rtemstoolkit/rld-process.h
index fc9b7bc..a9902b2 100644
--- a/rtemstoolkit/rld-process.h
+++ b/rtemstoolkit/rld-process.h
@@ -114,6 +114,13 @@ namespace rld
*/
tempfile (const std::string& suffix = ".rldxx", bool keep = false);
+ /**
+ * Get a temporary file given a name and a suffix.
+ */
+ tempfile (const std::string& name,
+ const std::string& suffix,
+ bool _keep = false);
+
/**
* Clean up the temporary file.
*/
--
2.27.0
More information about the devel
mailing list