Mercurial > octave
diff libinterp/corefcn/dirfns.cc @ 25742:d3c6de326bae
close/reload editor tab when file is (re)moved in gui terminal (bug #43922)
* file-editor.cc (handle_file_remove): new code structure
* main-window.cc (construct): connect new signals from octave_qt_link to the
slot handle_file_renamed and the new proxy slot file_remove_proxy;
(file_remove_proxy): proxy calling handle_file_remove but protected by the
mutex of octave_qt_link synchronizing worker and gui thread
* main-window.h: new slot file_remove_proxy
* octave-qt-link.cc (do_file_remove): new method for renaming or removing
files which signals the editor (gui thread) for closing the files before
removing is carried out;
(do_file_renamed): new method for re-loading renamed files into editor;
* octave-qt-link.h: new methods do_file_remove and do_file_renamed,
new signals used in the new methods for signaling the editor slots
* dirfns.cc (rmdir): call the new static octave_link method for removing
a file, which might be opened in the editor before removing a dir;
(rename): call the new static octave_link method for renaming a file,
which might be opened in the editor before renaming it and call the method
for reloading the new renamed file;
* octave-link.h (file_remove): new static method calling purely virtual method
do_file_remove, which is implemented in octave_qt_link;
(file_renamed): new static method calling purely virtual method
do_file_renamed, which is implemented in octave_qt_link
* syscalls.cc (unlink): call the new static octave_link method for removing
a file, which might be opened in the editor before removing it
author | Torsten <mttl@mailbox.org> |
---|---|
date | Sun, 17 Sep 2017 05:52:33 +0200 |
parents | 8945a6a6c0eb |
children | 00f796120a6d |
line wrap: on
line diff
--- a/libinterp/corefcn/dirfns.cc Sat Aug 04 13:35:29 2018 +0200 +++ b/libinterp/corefcn/dirfns.cc Sun Sep 17 05:52:33 2017 +0200 @@ -298,10 +298,18 @@ } if (doit) - status = octave::sys::recursive_rmdir (fulldir, msg); + { + octave_link::file_remove (fulldir, ""); + status = octave::sys::recursive_rmdir (fulldir, msg); + } } else - status = octave::sys::rmdir (fulldir, msg); + { + octave_link::file_remove (fulldir, ""); + status = octave::sys::rmdir (fulldir, msg); + } + + octave_link::file_renamed (status >= 0); if (status < 0) return ovl (false, msg, "rmdir"); @@ -424,12 +432,20 @@ std::string msg; + octave_link::file_remove (from, to); + int status = octave::sys::rename (from, to, msg); if (status < 0) - return ovl (-1.0, msg); + { + octave_link::file_renamed (false); + return ovl (-1.0, msg); + } else - return ovl (status, ""); + { + octave_link::file_renamed (true); + return ovl (status, ""); + } } DEFUN (glob, args, ,