Mercurial > octave
diff src/file-io.cc @ 5102:b04b30d30c66
[project @ 2004-12-28 01:59:05 by jwe]
author | jwe |
---|---|
date | Tue, 28 Dec 2004 01:59:05 +0000 |
parents | c9a44ec47b20 |
children | 1e36493572a0 |
line wrap: on
line diff
--- a/src/file-io.cc Fri Feb 01 21:16:56 2008 -0500 +++ b/src/file-io.cc Tue Dec 28 01:59:05 2004 +0000 @@ -52,11 +52,11 @@ #include <unistd.h> #endif +#include "error.h" #include "file-ops.h" +#include "lo-ieee.h" #include "defun.h" -#include "error.h" -#include "lo-ieee.h" #include "oct-fstrm.h" #include "oct-iostrm.h" #include "oct-map.h" @@ -65,7 +65,6 @@ #include "oct-stream.h" #include "oct-strstrm.h" #include "pager.h" -#include "pt-plot.h" #include "so-array.h" #include "sysdep.h" #include "utils.h" @@ -102,6 +101,29 @@ octave_stream_list::clear (); } +// List of files to delete when we exit or crash. +// +// XXX FIXME XXX -- this should really be static, but that causes +// problems on some systems. +std::stack <std::string> tmp_files; + +void +mark_for_deletion (const std::string& file) +{ + tmp_files.push (file); +} + +void +cleanup_tmp_files (void) +{ + while (! tmp_files.empty ()) + { + std::string filename = tmp_files.top (); + tmp_files.pop (); + unlink (filename.c_str ()); + } +} + static void maybe_warn_interface_change (const std::string& mode) {