
Beman Dawes wrote:
If you guys can come up with a good design for a temporary file feature, implement and test it, and provide at lease a sketch of some docs, I'd be happy to add it to the library. But I need to spend my time on other aspects of the library.
One feature I've used a lot is the ability to not actually delete the file (or directory - I often need temporary directories). When I'm tracking down a bug it is often helpful to retain the file so it can be inspected. That also implies knowing the path to the file.
Is the following "good design"? // The same as unique_path except that an empty file is created. path unique_file(const path& model="%%%%-%%%%-%%%%-%%%%") throws(...); path unique_file(const path& model, system::error_code& ec); path unique_file(const path& model="%%%%-%%%%-%%%%-%%%%", const path& parent_path) throws(...); path unique_file(const path& model, const path& parent_path, system::error_code& ec); // Unique directories are created path unique_directory(const path& model="%%%%-%%%%-%%%%-%%%%") throws(...); path unique_directory(const path& model, system::error_code& ec); path unique_directory(const path& model="%%%%-%%%%-%%%%-%%%%", const path& parent_path) throws(...); path unique_directory(const path& model, const path& parent_path, system::error_code& ec); struct temporary_file { // Uses unique_file. If delete_on_destruction is false you better go with the stand alone function temporary_file(const path& model="%%%%-%%%%-%%%%-%%%%", const path& parent_path = temp_directory_path(), bool delete_on_destruction = true) throws(...); const path& path() const; }; struct temporary_directory { // Uses unique_directory. If delete_on_destruction is false you better go with the stand alone function temporary_directory(const path& model="%%%%-%%%%-%%%%-%%%%", const path& parent_path = temp_directory_path(), bool delete_on_destruction = true) throws(...); const path& path() const; }; Thank you. Best regards Jorge